I always loved how World War Z showcased the failures of the military to contain a zombie threat because they rely so much on reducing enemy morale, which didn't work at all against a horde of mindless zombies who just keep coming regardless of what is thrown against them.
WWZ - the book -
deliberately made the military (actually, the Army) act stupidly because Brooks wanted it to be a commentary on government stupidity. The Army was completely unaware -- midway through a zombie apocalypse - that headshots were required, even though cops and everyone else knew that. And rather than put troops on elevated buildings, they had them dig in on the ground in fighting holes, etc.. It was like someone jammed every bad military cliché into a single book. He made the Marines fight more intelligently, which annoyed even me because it was so ham-handed.
Never read the book, but yeah, much of winning a battle is making the enemy run away. You remove that and you have to kill everyone which is laborious and takes time (think Okinawa and Iwo Jima).
Although in a zombie apocalypse, that's not an option, and the military would have had that figured out pretty quickly. But if you're fighting an enemy that is slow moving, mindless, and can't shoot, it would be a walkover. You wouldn't have to dig them out -- they'd just shamble right up to you to be shot.
Tanks. None of these films ever have tanks. Zombies are no match for tanks. Don't even need to shoot at them. Just form up on line and run them over.
Works in some terrain, does not work in others. And there just aren't enough tanks to be everywhere the zombies are anyway. The way to kill them in TWD, or in the book version of World War Z (slow-moving zombies) is simply to elevate rifleman off the ground where they can't be reached, and plug away at close distances. A decently trained infantryman would be able to kill hundreds per day, easily.
Anyway, a much more realistic look about the military fighting zombies is
Tooth and Nail. It's about an army company trying to defend a hospital in New York, and was pretty well-done. Even then, they had to use some artificialities to make it a fight.
The real challenge in a zombie apocalypse wouldn't be the fighting -- it would be what happened if normal supplies stopped flowing after a few days. No more food being trucked in to urban areas, etc.. If people all panicked and stayed home, essentially services would collapse. You'd need farmer, truckers, food processors, road maintenance, gas stations, etc., etc., all to keep functioning.