PowerShell Network Connections report

I am trying to add to this script the Friendly Name found in "Win32_PnPEntity".  An example can be found here: http://serverfault.com/questions/427234/getting-network-interface-device-name-in-powershell 

Here is the code I would like to integrate the "friendly name" powershell seen in the link above:

ForEach ($Adapter in (Get-WmiObject Win32_NetworkAdapter))
{  $Config = Get-WmiObject Win32_NetworkAdapterConfiguration -Filter "Index = '$($Adapter.Index)'"
   ForEach ($Addr in ($Config))
   {  New-Object PSObject -Property @{
         Name = $Adapter.Name
         NetName = $Adapter.NetConnectionID
         IP = $Addr.ipaddress
         MAC = $Config.MacAddress
         ConnStatus = $Adapter.NetConnectionStatus
      }
   }
}

Open in new window



Here is some of the code from the link:

$interfaces = Get-WmiObject Win32_NetworkAdapter
$interfaces | ForEach{
    $friendlyname = $_ | ForEach-Object { $_.NetConnectionID }
    $name = $_.GetRelated("Win32_PnPEntity") | Select-Object -ExpandProperty Name
    # This tests to ensure friendlyname isn't null
    if($friendlyname){
        "$friendlyname is $name"
    }
}

Open in new window

LVL 8
K BAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

footechCommented:
Are you seeing some difference between the NetConnectionID (which you display as "NetName") and this "friendlyname"?  I've always observed them to be the same.
0
K BAuthor Commented:
yes they are missing an important part, the number

for example:
Broadcom NetXtreme Gigabit Ethernet instead of
Broadcom NetXtreme Gigabit Ethernet #5
0
footechCommented:
Here you go.
ForEach ($Adapter in (Get-WmiObject Win32_NetworkAdapter))
{  $Config = Get-WmiObject Win32_NetworkAdapterConfiguration -Filter "Index = '$($Adapter.Index)'"
   ForEach ($Addr in ($Config))
   {  New-Object PSObject -Property @{
         Name = $Adapter.Name
         NetName = $Adapter.NetConnectionID
         IP = $Addr.ipaddress
         MAC = $Config.MacAddress
         ConnStatus = $Adapter.NetConnectionStatus
         Friendly = $Adapter.GetRelated("Win32_PnPEntity") | Select-Object -ExpandProperty Name
      }
   }
}

Open in new window

1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
K BAuthor Commented:
You are brilliant! thank you!
0
footechCommented:
Glad I could help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.