Re: Find Default Network Card NIC



"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
.



Relevant Pages

  • Re: Find Default Network Card NIC
    ... the code is identical on the two machines. ... For information about WMI you can start from the Microsoft Script Center ... Where NetConnectionID '' ...
    (microsoft.public.scripting.vbscript)
  • Re: Permissions to execute the script
    ... I am using a vbscript to query the WMI classes. ... The script uses the ... On some machines, this vbscript works fine but on some machines this ... winmgmt /clearadap ...
    (microsoft.public.scripting.vbscript)
  • Re: 80041021 error - GetObject stdRegProv
    ... On a very small number of machines I see this ... error code 80041021, with no further explanation. ... it references is the WMI GetObject where I grab the stdRegProv. ... But the script runs flawlessly on ...
    (microsoft.public.scripting.vbscript)
  • Re: Creating a session in windows to auth to remote machines
    ... machines because they're all in the same domain and I run the script ... username etc. with WMI. ...
    (comp.lang.python)
  • Re: Using VBS to scan NT machines for KB828028 (MS04-007)
    ... you could try my script which will do much more than ... just one hotfix... ... How are you getting this to work with NT4 machines? ... WMI never returns a ...
    (microsoft.public.scripting.vbscript)

Loading