Win32_NetworkAdapterConfiguration Loop through W2K machines

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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
.



Relevant Pages

  • Re: Setup Power Scheme option for laptop users
    ... I am going to have to look into this then as - as mentioned - pretty much all machines are pretty much new Dells running Windows XP SP3. ... "Meinolf Weber " wrote in message ... We use powercfg with our own created powerscheme for up to 1000 workstations, 98% Laptops without any problem within a mixed envrionment from Windows 2000 and Windows XP SP3. ... I have indeed used that before (as a startup script) and in roughly ...
    (microsoft.public.windows.group_policy)
  • Re: DST Updates Deployed via Group Policy
    ... I did run the script locally on the testing machine ... WAS able to select the group in the GPO editor so I assumed that it could ... things are working, that is, the machines are being healthy little ... Windows 2000 Pro machines and 2 Windows 2000 Servers that require this ...
    (microsoft.public.windows.group_policy)
  • RE: Local Admin Password
    ... You can use cusrmgr.exe from the Windows 2000 Resource Kit. ... You may be able to use the ListMembers.vbs script from the Windows 2000 ... you much closer than having to create a list of 2000 machines manually. ...
    (microsoft.public.win2000.active_directory)
  • Re: Change local administrator password for all PCs in the domain
    ... > I have about 200 workstations in my Windows 2000 domain. ... you could setup a custom script or Group Policy (in ... no workgroup machines. ...
    (microsoft.public.windows.server.scripting)
  • Re: How to ping multiple machines from txt file?
    ... > For Each strTarget In arrTargets ... > The problem I have is that I have over 450 machines to resolve and I am not ... > about to add each one in the Array, ... This sample script should help you: ...
    (microsoft.public.scripting.vbscript)