IP address script - takes too long
From: Mark Whidby (mark.whidby_at_manchester.ac.uk)
Date: 03/01/05
- Next message: Bart Perrier: "Re: CIM_Datafile"
- Previous message: EAGroff: "Join a PC to the domain completely via VBScript with ADSI"
- Next in thread: Mark Whidby: "Re: IP address script - takes too long"
- Reply: Mark Whidby: "Re: IP address script - takes too long"
- Messages sorted by: [ date ] [ thread ]
Date: 1 Mar 2005 22:25:04 GMT
I'm new to scripting so I hope someone can tell me what's wrong
here. The following script is copied from one of the examples from
Microsoft and outputs a PC's IP addresses:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root
\cimv2")
Set IPConfigSet = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where
IPEnabled=TRUE")
wscript.echo "Start in script",Time
For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
WScript.Echo IPConfig.IPAddress(i)
Next
End If
Next
wscript.echo "Finished in script",Time
I call it with this batch file:
@echo off
echo.|time|find "current"
cscript c:\colinux\batch\stub.vbs //nologo
echo.|time|find "current"
Here is some sample output (edited to hide the true IP address):
d:\temp>c:\colinux\batch\stub
The current time is: 22:16:20.36
Start in script 22:16:20
nnn.nn.148.142
192.168.0.1
Finished in script 22:16:20
The current time is: 22:16:30.97
My question is - why does it take about 10 seconds to pass control
back to the batch file? It must be something to do with the
particular PC I run it on (my work PC) as it runs OK on my home PC.
Any ideas?
- Next message: Bart Perrier: "Re: CIM_Datafile"
- Previous message: EAGroff: "Join a PC to the domain completely via VBScript with ADSI"
- Next in thread: Mark Whidby: "Re: IP address script - takes too long"
- Reply: Mark Whidby: "Re: IP address script - takes too long"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|