Option Explicit Dim strComputer, strQuery ' Check command line arguments If WScript.Arguments.Named.Count > 0 Then Syntax Select Case WScript.Arguments.Unnamed.Count Case 0 ' Default is local computer if none specified strComputer = "." Case 1 If InStr( WScript.Arguments.Unnamed(0), "?" ) > 0 Then ' A "?" in the argument means display help Syntax Else strComputer = WScript.Arguments.Unnamed(0) End If Case Else ' No more than 1 argument allowed Syntax End Select ' Connect to computer strQuery = "SELECT * FROM Win32_OperatingSystem WHERE Primary=True" Set OpSysSet = GetObject( "winmgmts:{(Shutdown)}//" & strComputer & "/root/cimv2" ).ExecQuery( strQuery ) ' Actual reboot command For Each OpSys In OpSysSet OpSys.Reboot() Next Sub Syntax Dim strMsg strMsg = "Reboot.vbs, Version 2.10" & vbCrLf _ & "Reboot any WMI enabled computer on the network." _ & vbCrLf & vbCrLf _ & "Usage: " & UCase( WScript.ScriptName ) _ & " [ computer_name ]" & vbCrLf & vbCrLf _ & "Where: ""computer_name"" is the name of the " _ & "computer to be rebooted" & vbCrLf _ & " (without leading backslashes)." _ & vbCrLf & vbCrLf _ & " Default is ""."" (the local computer)." _ & vbCrLf & vbCrLf _ & "Based on a post by Alex Angelopoulos on www.developersdex.com." _ & vbCrLf & vbCrLf _ & "Written by Rob van der Woude" & vbCrLf _ & "http://www.robvanderwoude.com" Wscript.Echo( strMsg ) Wscript.Quit 1 End Sub