A. The following script will write to screen each IP address on a client.
Option Explicit Dim IPConfigSet, IPConfig, i set IPConfigSet = GetObject("winmgmts:\{impersonationLevel=impersonate\}!root\cimv2").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 if next
The output below shows a sample execution.
D:\temp>cscript listip.vbs Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. 10.10.15.105 192.168.1.57
0 comments
Hide comments