hmcgeehan
asked on
VBSCRIPT - computer exists?
Hi
Anyone know how to check if a computer on my domain is up or down?
I tried doing this but it says success when the drive p: doesnt exist!
dim WSHNetwork, WSHShell
Dim FileSysObj
set WSHShell=Wscript.CreateObj ect("Wscri pt.Shell")
Set WSHNetwork=Wscript.CreateO bject("Wsc ript.Netwo rk")
ON ERROR RESUME Next
share = "\\pc024"
Drive = "p:"
If FileSysObj.DriveExists(sha re)=True Then
if FileSysObj.DriveExists(Dri ve)=True Then
'WSHNetwork.RemoveNetworkD rive Drive
MsgBox "Success!" & share & "\" & drive & " does exist"
else
MsgBox "Error!" & share & "\" & drive & " does not exist"
end If
end If
Anyone know how to check if a computer on my domain is up or down?
I tried doing this but it says success when the drive p: doesnt exist!
dim WSHNetwork, WSHShell
Dim FileSysObj
set WSHShell=Wscript.CreateObj
Set WSHNetwork=Wscript.CreateO
ON ERROR RESUME Next
share = "\\pc024"
Drive = "p:"
If FileSysObj.DriveExists(sha
if FileSysObj.DriveExists(Dri
'WSHNetwork.RemoveNetworkD
MsgBox "Success!" & share & "\" & drive & " does exist"
else
MsgBox "Error!" & share & "\" & drive & " does not exist"
end If
end If
then
if FileSysObj.DriveExists(Dri ve) Then
'WSHNetwork.RemoveNetworkD rive Drive
MsgBox "Success!" & share & "\" & drive & " does exist"
else
MsgBox "Error!" & share & "\" & drive & " does not exist"
end If
if FileSysObj.DriveExists(Dri
'WSHNetwork.RemoveNetworkD
MsgBox "Success!" & share & "\" & drive & " does exist"
else
MsgBox "Error!" & share & "\" & drive & " does not exist"
end If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi itdrms,
Great code !! I don't know whether the above code is useful in this particular question or not... but in general this is a very useful piece of code for me !!
Thanks a lot !!
Cheers,
VIkas.
Great code !! I don't know whether the above code is useful in this particular question or not... but in general this is a very useful piece of code for me !!
Thanks a lot !!
Cheers,
VIkas.
well, since your asking, I'd appreciate getting the points. I tested my script against the 3 possibilites of server state and the script worked properly to determine if a computer is up or down. Thx
Drive = "p"