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

Group Policy Event ID 1058 Error Code 1326 (The user name or password is incorrect)

Suspicious event log Event ID: 4905

DCOM received error "2147746132" from...