Win32_NetworkAdapterConfiguration Loop through W2K machines
- From: "Salty" <Salty@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 9 Sep 2005 04:30:02 -0700
I have knocked up a script to retrieve IP info from an array of machines. It
works fine as long as every machine is Windows 2003 or Windows XP, but if
there is anything of an earlier OS in the array the results are repeated. So
for an array with 3 W2k machines (or NT with WMICORE installed) every PC /
Server will produce the same results. Any suggestions would be welcome.
Script below:
Option Explicit
On Error Resume Next
Dim arrComputers, strComputer, objWMIService, colItems
Dim objItem, strDefaultIPGateway, strIPAddress
arrComputers =
Array("computer1","computer2","computer3","computer4","computer5")
For Each strComputer In arrComputers
WScript.Echo
WScript.Echo "=========================================="
WScript.Echo "Computer: " & strComputer
WScript.Echo "=========================================="
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM
Win32_NetworkAdapterConfiguration where IPEnabled = True", , 48)
For Each objItem In colItems
strDefaultIPGateway = Join(objItem.DefaultIPGateway, ",")
WScript.Echo "DefaultIPGateway: " & strDefaultIPGateway
WScript.Echo "DHCPServer: " & objItem.DHCPServer
strIPAddress = Join(objItem.IPAddress, ",")
WScript.Echo "IPAddress: " & strIPAddress
strIPSubnet = Join(objItem.IPSubnet, ",")
WScript.Echo "IPSubnet: " & strIPSubnet
WScript.Echo "MACAddress: " & objItem.MACAddress
WScript.Echo "WINSPrimaryServer: " & objItem.WINSPrimaryServer
WScript.Echo "WINSSecondaryServer: " & objItem.WINSSecondaryServer
WScript.Echo
Next
Next
--
Mark Salter
Senior ICT Officer
Rhondda Cynon Taf County Borough Council
.
- Follow-Ups:
- Re: Win32_NetworkAdapterConfiguration Loop through W2K machines
- From: Jonathan Liu [MSFT]
- Re: Win32_NetworkAdapterConfiguration Loop through W2K machines
- Prev by Date: Re: how to import users from a csv
- Next by Date: Re: Renaming a file..
- Previous by thread: Moving a work*** in Excel
- Next by thread: Re: Win32_NetworkAdapterConfiguration Loop through W2K machines
- Index(es):