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

Schannel Issue

Indexing Server

oclist /xml or /?