Network adapters

Hi, I’ve been struggling with this for about a week and I’m hoping someone one can share an example that I can build from. I’m trying to get the ip addresses of all active network adapters on a local computer and list them respectively (Wireless, VPN and Wired Connection). Thanks for any help in advance.

Hi

Something like this?

Link: https://blogs.technet.microsoft.com/heyscriptingguy/2014/01/12/weekend-scripter-use-powershell-to-identify-network-adapter-characteristics/

Regards

Jarkko

I’ve only got the one operational adapter on mine. Try this. It’s a little more elegant.
$NetAdapter = (Get-NetAdapter).where({$PSItem.Status -eq ‘Up’})
(Get-NetIPAddress).where({$PSItem.InterfaceAlias -eq $NetAdapter.InterfaceAlias})

Thanks but I cant get the Get-NetAdapter to work. The computers I work on are windows 7. Looks like that isn’t available unless I upgrade to win 8.

How about: (Get-WmiObject -Class Win32_NetworkAdapterConfiguration).where({$PSItem.IPAddress -ne $null})

Also, I just realized that the where method isn’t available if you’re on straight PowerShell 2, so here would be something more appropriate.

Get-WmiObject -Class Win32_NetworkAdapterConfiguration | Where-Object IPAddress -ne $null

My bad.

Thanks that definitely gets me closer. Is there a way to separate them or label them as wireless, wired, vpn?

if you add sort description on the end

Get-WmiObject -Class Win32_NetworkAdapterConfiguration | Where-Object IPAddress -ne $nul |sort description