Skip to content

Instantly share code, notes, and snippets.

@mattrude
Created September 17, 2010 23:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattrude/585164 to your computer and use it in GitHub Desktop.
Save mattrude/585164 to your computer and use it in GitHub Desktop.
|==========================================================================
|
| 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