Hi
I'm new to vb scripting and what I'm trying to do is reboot a remote machine with a script and at the same time the server is reloading the script will bring up a running dos ping command. Unfortunatley whenever i try running this script it brings up multiple dos boxes and freezes my pc.
Here is the code.
Iam running this script within a hta file if thats any help.
==============================================
Sub GetRestart
strcomputer = ""
strComputer = servername.value
if strcomputer = "" Then
Msgbox "Please enter a server name"
exit sub
End if
On error resume next
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\\" & _
strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Reboot()
Next
set wshShell= createobject("wscript.shell")
wshShell.run "%comspec% /k ping -t " & strcomputer ,1,true
End Sub
=====================================
I'm new to vb scripting and what I'm trying to do is reboot a remote machine with a script and at the same time the server is reloading the script will bring up a running dos ping command. Unfortunatley whenever i try running this script it brings up multiple dos boxes and freezes my pc.
Here is the code.
Iam running this script within a hta file if thats any help.
==============================================
Sub GetRestart
strcomputer = ""
strComputer = servername.value
if strcomputer = "" Then
Msgbox "Please enter a server name"
exit sub
End if
On error resume next
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\\" & _
strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Reboot()
Next
set wshShell= createobject("wscript.shell")
wshShell.run "%comspec% /k ping -t " & strcomputer ,1,true
End Sub
=====================================