grc.com has a program (very small) that does it. The program is called "wizmo" and is written in Assembly.
If you are using Windows NT/2000/XP you can get a program in MS Windows Resource Kit called "shutdown.exe" but the program does only the shutdown job. You must manually turn the machine off.