' Restart a Computer
strComputer = InputBox (" Please Enter the Computer Name to restart ",_
"Enter Computer Name")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\\" & _
strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
'issue shutdown to OS'
4 = force logoff
' 5 = force shutdown
' 6 = force rebooot
' 12 = force power off
Number = InputBox(" Enter the Number" & vbCrLf & vbCrLf & "4 = Force logoff"
& vbCrLf & "5 = Force shutdown" & vbCrLf & "6 = Force rebooot" & vbCrLf & "12
= Force power off", "What you Want to Do")
For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Win32ShutDown(Number)
WScript.Echo "The Requested Operation is Performed in " & strComputer
Next
digg_url="http://syztemlabs.blogspot.com/2007/11/restart-remote-computer.html";
My Favourite Videos
Wednesday, January 16, 2008
RESTART A REMOTE COMPUTER
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment