Home » The PARIS Forums » PARIS: Main » muli pc shutdown script
muli pc shutdown script [message #84753] |
Fri, 18 May 2007 04:30 |
John [1]
Messages: 2229 Registered: September 2005
|
Senior Member |
|
|
here's a nice little script that will shutdown multiple computers with one
doubleclick on PCs. I use it at the end of a day, doubleclick and everything
shuts down. I hope it helps. Just put it in a text file with .vbs extension
'=========================================================== ===============
' The following function will test if a machine is reachable via a ping
' using WMI and the Win32_PingStatus Class
'=========================================================== ===============
'Shutdown Win2003 Computer
If Reachable("win2003") Then
'WScript.Echo "Computer is Reachable!"
Set wshShell = WScript.CreateObject ("WSCript.shell")
wshshell.run "shutdown -s -m \\win2003 -f -t 01" , 6, True
set wshshell = nothing
Else
'WScript.Echo "Computer is Unreachable!"
End If
'Shutdown Studio Computer
If Reachable("studio") Then
'WScript.Echo "Computer is Reachable!"
Set wshShell = WScript.CreateObject ("WSCript.shell")
wshshell.run "shutdown -s -m \\studio -f -t 01" , 6, True
set wshshell = nothing
Else
'WScript.Echo "Computer is Unreachable!"
End If
'Shutdown Desktop Computer
If Reachable("desktop") Then
'WScript.Echo "Computer is Reachable!"
Set wshShell = WScript.CreateObject ("WSCript.shell")
wshshell.run "shutdown -s -m \\desktop -f -t 01" , 6, True
set wshshell = nothing
Else
'WScript.Echo "Computer is Unreachable!"
End If
'Shutdown Laptop Computer
Set wshShell = WScript.CreateObject ("WSCript.shell")
wshshell.run "shutdown -s -m \\squigy -f -t 01" , 6, True
set wshshell = nothing
Function Reachable(strComputer)
' On Error Resume Next
Dim wmiQuery, objWMIService, objPing, objStatus
wmiQuery = "Select * From Win32_PingStatus Where Address = '" & strComputer
& "'"
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set objPing = objWMIService.ExecQuery(wmiQuery)
For Each objStatus in objPing
If IsNull(objStatus.StatusCode) Or objStatus.Statuscode<>0 Then
Reachable = False 'if computer is unreacable, return false
Else
Reachable = True 'if computer is reachable, return true
End If
Next
End Function
|
|
|
Goto Forum:
Current Time: Wed Mar 26 21:36:40 PDT 2025
Total time taken to generate the page: 0.09030 seconds
|