views:

173

answers:

2

I have a requirement to trigger a reboot on a windows7 machine programmatically. This is to support a scenario for customers where when they log out of an intenet kiosk machine the machine reboots. On XP this was achieved using WTSSystemShutdown but Im wondering if theres another way. Any pointers greatly appreciated.

+4  A: 

You can call ExitWindowsEx to restart, shutdown, logoff, etc.

Use InitiateShutdown (Vista) or InitiateSystemShutdownEx (Win2k or higher) to shutdown a computer remotely.

Gabe
A: 

I answered a similar question here (complete with sample code):

Log off user from Win XP programmatically in C# (ExitWindowsEx)

Just change the uFlags parameter to ExitWindows.Reboot.

Kev