Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remote shutdown a computer room

Status
Not open for further replies.

alanbloom

Technical User
Apr 22, 2005
81
GB
Wanting to save power (and the invironment!) and time, I have made a batch file to remote shutdown a training room of computers using the following DOS command:

shutdown -s -f -m computername

It does work, however, it doesn't power them off - Windows closes and I get the window 'your computer is ready to switch off'. Ideally, I would like the batch file or command to actually turn the computer off by the power too, just as a normal shutdown command from the computer itself. Do I need to modify the command/computer settings, etc? Or is it not possible? The workstations are mostly Windows 2000.
 
Try this vbscript, you could also download devcon from Microsoft's website

Const SHUTDOWN = 1
Const LOGOFF = 0
Const Reboot = 2
Const ForcedLogoff = 4
Const ForcedShutdown = 5
Const ForcedReboot = 6
Const PowerOff = 8
Const ForcedPowerOff = 12


strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery ("SELECT * FROM Win32_OperatingSystem")
For Each objOperatingSystem In colOperatingSystems
ObjOperatingSystem.Win32Shutdown(12)
Next
 
Thanks for that - very good answer.

Not familiar with using VB Script to control computers so will have to have a look into how to use it but it's a great pointer and sure will solve the problem :)

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top