Re: Find Default Network Card NIC
- From: urkec <urkec@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 18 May 2008 12:16:04 -0700
"Monitor" wrote:
Nice solution! Two questions:
- I copied your code verbatim to a .vbs file, without making any
changes, then ran it on two machines. On one it ran flawlessly,
on the other it generated an error message for this line of code:
For Each strIPAddr In objNICConfig.IPAddress
nic.vbs(19, 4) Microsoft VBScript runtime error: Object not a collection
As I said, the code is identical on the two machines. Do you have
a suggestion why objNICConfig.IPAddress might not be a collection
on one machine?
- Where can I look up all this useful WMI stuff?
You will receive that error if objNICConfig.IPAddress is Null, you can check
that before trying to enumerate the collection:
If Not IsNull (objNICConfig.IPAddress) Then
For Each strIPAddr In objNICConfig.IPAddress
strIP = strIP & strIPAddr & " "
Next
Else
strIP = "Null"
End If
For information about WMI you can start from the Microsoft Script Center
(links like: Script Repository, Scriptomatic, Windows 2000 Scripting Guide,
Hey Scripting Guy, WMI SDK)
http://www.microsoft.com/technet/scriptcenter/default.mspx
CIM Studio is useful:
http://www.microsoft.com/downloads/details.aspx?familyid=6430F853-1120-48DB-8CC5-F2ABDC3ED314&displaylang=en
Also WMI Code Creator:
http://www.microsoft.com/downloads/details.aspx?FamilyID=2cc30a64-ea15-4661-8da4-55bbc145c30e&displaylang=en
--
urkec
.
- Follow-Ups:
- Re: Find Default Network Card NIC
- From: Monitor
- Re: Find Default Network Card NIC
- References:
- Find Default Network Card NIC
- From: Daz
- Re: Find Default Network Card NIC
- From: Pegasus \(MVP\)
- Re: Find Default Network Card NIC
- From: Daz
- Re: Find Default Network Card NIC
- From: Daz
- Re: Find Default Network Card NIC
- From: urkec
- Re: Find Default Network Card NIC
- From: Monitor
- Find Default Network Card NIC
- Prev by Date: Help will empty field entry handling
- Next by Date: Re: Find Default Network Card NIC
- Previous by thread: Re: Find Default Network Card NIC
- Next by thread: Re: Find Default Network Card NIC
- Index(es):
Relevant Pages
|
Loading