Get ip address from multiple nic


hi,

writing script query bunch fo servers information. thing im stuck on getting ip address has multiple nic cards. so.. want grab none blank ip line ofcourse has actual ip.

  $ip = get-wmiobject -computer $server -class "win32_networkadapterconfiguration" | select-object ipaddress    foreach($i in $ip|?{$_.ipaddress -ne ""}){  $address = $i.ipaddress  }  

so noticed grabs right ip if last nic card.. loops through ips , if last nic blank output blank one. |?{$_.ipaddress -ne ""}){ not doing anything. suggestion?

thanks

  get-wmiobject -computer $server -class "win32_networkadapterconfiguration" -filter "ipenabled='true'"  



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

DCOM received error "2147746132" from...

DFSR RPC replication errors 5014 1726 with large files over VPN

ADFS 3.0 Event ID 4625 | An Error occurred During Logon | Status: 0xC000035B