PowerShell - Win32_NetworkAdapterConfiguration from text list
- Jon Boyette
- Jan 12, 2022
- 1 min read
Name as a NetworkDiscoverFromList.ps1 or similar, this takes servers/computers populated in c:\temp\servers.txt and Gets the ENABLED NIC(s), DNSHostName, DHCPEnabled, IPAddress, DefaultIPGateway, DNSDomain, ServiceName, Description, and outputs to C:\temp\AllActiveNetWorkAdapters.TXT
$r = Get-Content c:\temp\servers.txt
If (-Not (Test-Connection -ComputerName $r -Count 1 )) {Continue}
Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE -ComputerName $r | Select DNSHostName, DHCPEnabled, IPAddress, DefaultIPGateway, DNSDomain, ServiceName, Description, Index | FT | Out-File C:\temp\AllActiveNetWorkAdapters.txt
Comments