Well recently a shutdown script that I wrote did not shutdown a server successfully for some odd reason. The script looks like the following:
shutdown -r -t 20 -c “Shutting Down to Install Windows Updates”
So until now this script has been working flawlessly on multiple servers. I’ve been able to schedule automatic reboots of remote servers easily using this script in combination with windows scheduled tasks as well. It comes in handy when you need to reboot the server at a specific time, such as 5:25PM or 1:26AM, which is great for me since I do a lot of remote server maintenance and do not have physical access to these servers.
Anyway, after trying to reboot this one server it gave me a exit code of (0x47f) which showed up in the scheduled tasks log.
After Looking up the exit code, I found a website that directed me to convert 47f to decimal and enter the decimal value “net helmsg” in the command line. The command I entered was “net helpmsg 1271″, which gave me the following answer: “The machine is locked and can not be shut down without the force option”.
Well isn’t that great! A error code that is easily understandable from Microsoft!
The solution to this problem was to edit my script to include the force option. Here is the updated script below:
shutdown -r -f -t 20 -c “Shutting Down to Install Windows Updates”
And that should do the trick.
http://www.tech-archive.net/Archive/Windows/microsoft.public.windows.terminal_services/2006-08/msg00331.html

