Hello Scripters,
Having a problem:
when I run my scripts, a sample:
(finds user logged on somewhere on the net.)
*****************************************
Dim objDomain, objShell, objExecObject
Dim compSystem, strUser, strComputer
Set objShell = WScript.CreateObject("WScript.Shell"
Set ObjDomain = GetObject("WinNT://DOMAIN"
WScript.stdOut.Write "User to be found (domain\user_name): "
strUser = WScript.stdIn.ReadLine
WScript.Echo "Looking for user: " & strUser
strUser = UCase(strUser)
ObjDomain.Filter = Array("Computer"
On Error Resume Next
for each strComputer in objDomain
Set objExecObject = objShell.Exec("%comspec% /c ping.exe -n 1 " & strComputer.name)
Do until objExecObject.stdOut.AtEndOfStream
strLine = objExecObject.stdOut.Readline()
strReply = Instr(strLine, "Reply"
If strReply <> 0 Then
For Each compSystem in Getobject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer.name).InstancesOf("Win32_ComputerSystem"
WScript.stdOut.Write("."
If UCase(compSystem.userName) = strUser Then
WScript.stdOut.WriteLine vbcrlf & compSystem.name
End If
Next
End If
Loop
Next
WScript.Echo vbcrlf & "Done!"
*******************************************
it hangs on some computers for a few minutes (up to 5-10 min.), other computers are processed within 10-30 seconds. The script is run on WIN 2K SP4 station and stations in my domain (NT domain - NT4.0 Servers) are mostly WIN2K. Is there a way to set a timeout for connection to remote PC?
thanx,
eduard
Having a problem:
when I run my scripts, a sample:
(finds user logged on somewhere on the net.)
*****************************************
Dim objDomain, objShell, objExecObject
Dim compSystem, strUser, strComputer
Set objShell = WScript.CreateObject("WScript.Shell"
Set ObjDomain = GetObject("WinNT://DOMAIN"
WScript.stdOut.Write "User to be found (domain\user_name): "
strUser = WScript.stdIn.ReadLine
WScript.Echo "Looking for user: " & strUser
strUser = UCase(strUser)
ObjDomain.Filter = Array("Computer"
On Error Resume Next
for each strComputer in objDomain
Set objExecObject = objShell.Exec("%comspec% /c ping.exe -n 1 " & strComputer.name)
Do until objExecObject.stdOut.AtEndOfStream
strLine = objExecObject.stdOut.Readline()
strReply = Instr(strLine, "Reply"
If strReply <> 0 Then
For Each compSystem in Getobject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer.name).InstancesOf("Win32_ComputerSystem"
WScript.stdOut.Write("."
If UCase(compSystem.userName) = strUser Then
WScript.stdOut.WriteLine vbcrlf & compSystem.name
End If
Next
End If
Loop
Next
WScript.Echo vbcrlf & "Done!"
*******************************************
it hangs on some computers for a few minutes (up to 5-10 min.), other computers are processed within 10-30 seconds. The script is run on WIN 2K SP4 station and stations in my domain (NT domain - NT4.0 Servers) are mostly WIN2K. Is there a way to set a timeout for connection to remote PC?
thanx,
eduard