Created
September 17, 2010 23:54
-
-
Save mattrude/585164 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|========================================================================== | |
| | |
| COMMENT: Remotely reboots a PC. May use machine name or IP address. | |
| | |
|========================================================================== | |
On Error Resume Next | |
mname = InputBox("Enter Machine Name", "Reboot Machine") | |
If Len(mname) = 0 Then Wscript.Quit | |
if Msgbox("Are you sure you want to reboot machine " & mname, vbYesNo, "Reboot Machine") = vbYes then | |
Set OpSysSet = GetObject("winmgmts:{impersonationLevel=impersonate,(RemoteShutdown)}//" & mname).ExecQuery("select * from Win32_OperatingSystem where Primary=true") | |
for each OpSys in OpSysSet | |
OpSys.Reboot() | |
next | |
end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment