How to get NICs with DHCP enabled?
A one liner code to get DHCP network interfaces card and its IP Address settings.
A one liner code to get DHCP network interfaces card and its IP Address settings.
Get-WmiObject win32_networkadapterconfiguration | where {$_.DHCPEnabled -eq “True”}
To save a few more bytes used this code:
gwmi win32_networkadapterconfiguration | ? {$_.DHCPEnabled -eq “True”}
A quick and easy way to get DHCP enabled NICs with the help
of PowerShell.
Sample output:
DHCPEnabled : True
IPAddress :
{192.168.11.50}
DefaultIPGateway : {192.168.11.254}
DNSDomain :
CiscoFW_01
ServiceName :
e1cexpress
Description :
Intel(R) 82579LM Gigabit Network Connection
Index : 7
DHCPEnabled :
True
IPAddress :
DefaultIPGateway :
DNSDomain :
ServiceName :
BthPan
Description :
Bluetooth Device (Personal Area Network)
Index : 22
DHCPEnabled :
True
IPAddress :
DefaultIPGateway :
DNSDomain :
ServiceName :
RTL8192su
Description :
TP-LINK 150Mbps Mini Wireless N USB Adapter
Index : 23
DHCPEnabled :
True
IPAddress :
DefaultIPGateway :
DNSDomain :
ServiceName :
netr73
Description :
D-Link Wireless G DWA-110 USB Adapter
Index : 25
Cheers..Hope it helps.. :)
Comments
Post a Comment