Hi all,
Not sure how to output only the network portion (first three octets) of the IP address. And to eliminate the "IP" and "--" output part also. Just the first three octets of the IP.
PS C:\SCRIPTS\Alabama> function Get-NetworkConfig {
Get-WmiObject Win32_NetworkAdapter -Filter 'NetConnectionStatus=2' |
ForEach-Object {
$result = 1 | Select-Object Name,IP
$result.Name = $_.Name
$config = $_.GetRelated('Win32_NetworkAdapterConfiguration')
$result.IP = $config | Select-Object -expand IPAddress
$result
}
}
Get-NetworkConfig | where-object {$_.IP -match '172'} | Format-Table IP
# Get-NetworkConfig | Format-Table IP
IP
--
172.18.202.113
Thanks