You are not logged in.

#1 12 Nov 2012 11:11

abis
Member
Registered: 25 Aug 2012
Posts: 3

Reboot computer

Hi,
i post that topic for Virtualization Zero Client Solution.
Why? Because sometime you need to restart the OS and for zero client you need to disable from policy option to shutdown the station, to prevent user to turn off the virtual machine and that affect restart option to... So in that way we can use that script which offer the confirmation to.

if Msgbox("Are you sure you want to reboot computer? " & strComputer, vbYesNo, "Reboot Computer") = vbYes then

strComputer = "localhost"

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\\" & _
strComputer & "\root\cimv2")

Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Reboot()
Next
end if

Feedback's are welcome to improve the code.
Thank you.

Last edited by abis (22 Nov 2012 15:30)

Offline

Board footer

Powered by