Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
September 9, 2005
A. The following script will write to screen each IP address on a client.
Option Explicit Dim IPConfigSet, IPConfig, iset IPConfigSet = GetObject("winmgmts:{impersonationLevel=impersonate}!rootcimv2").ExecQuery("SELECT IPAddress, DefaultIPGateway FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE")for each IPConfig in IPConfigSet if Not IsNull(IPConfig.IPAddress) then wscript.echo IPConfig.IPAddress(i) end ifnext
The output below shows a sample execution.
D:temp>cscript listip.vbsMicrosoft (R) Windows Script Host Version 5.6Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.10.10.15.105192.168.1.57
You May Also Like