Visual Basic - vbs no funciona en windows 2000

Life is soft - evento anual de software empresarial
 
Vista:

vbs no funciona en windows 2000

Publicado por guifre bosch (1 intervención) el 25/07/2007 10:41:30
Tengo un *.VBS que me dice si un PC responde a la red (hace un ping) o no responde.
El problema es que funciona en Windows XP pero no en Windows 2000.
Que puedo hacer para solucionar este problema?

El codigo:

Option Explicit
Dim strHost

strHost = InputBox("Quin equip vols veure?","Computer name")

if Ping(strHost) = True then
Wscript.Echo "L'equip " & strHost & " FUNCIONA! "
Else
Wscript.Echo "L'equip " & strHost & " NO RESPON!"
end if

Function Ping(strHost)

dim objPing, objRetStatus

set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery _
("select * from Win32_PingStatus where address = '" & strHost & "'")

for each objRetStatus in objPing
if IsNull(objRetStatus.StatusCode) or objRetStatus.StatusCode<>0 then
Ping = False
else
Ping = True
end if
next
End Function

gracias!
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder