I struggled a long time trying to get remote shutdown via the command line working in a Windows 7/Vista environment (specifically a Windows 7 machine attempting to remotely reboot or shutdown a Windows Vista machine). The shutdown.exe command line utility that worked fine under XP/2003 just didn’t work, usually giving an “Error 5,” which I gather is some kind of permissions issue.
As usual with one of these annoying, should-be-simple technical problems with Windows, SysInternals already has it all worked out for you. Their PsShutdown utility “just works.” In my case the magic command line was:
psshutdown \\ComputerName -u UserName(OnRemoteMachine) -p Password(OnRemoteMachine) -s