Hello
I am trying to set up a script that I can use to shutdown a number of PCs on the network each night.
I have got the following code from the Microsoft website:
Const SHUTDOWN = 1
strComputer = "f110-00000004"
Set objWMIService = GetObject("winmgmts: {(Shutdown)}" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2"
Set colOperatingSystems = objWMIService.ExecQuery _
("SELECT * FROM Win32_OperatingSystem"
For Each objOperatingSystem in colOperatingSystems
ObjOperatingSystem.Win32Shutdown(SHUTDOWN)
Next
However even though it is a script from MS apart from the PC name it gives an error on the third line. Set obj etc.
Can anyone help or even point me in the direction of a website with some good scripting examples.
Thanks
I am trying to set up a script that I can use to shutdown a number of PCs on the network each night.
I have got the following code from the Microsoft website:
Const SHUTDOWN = 1
strComputer = "f110-00000004"
Set objWMIService = GetObject("winmgmts: {(Shutdown)}" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2"
Set colOperatingSystems = objWMIService.ExecQuery _
("SELECT * FROM Win32_OperatingSystem"
For Each objOperatingSystem in colOperatingSystems
ObjOperatingSystem.Win32Shutdown(SHUTDOWN)
Next
However even though it is a script from MS apart from the PC name it gives an error on the third line. Set obj etc.
Can anyone help or even point me in the direction of a website with some good scripting examples.
Thanks