I'd like to create a powershell script to show which network interface is down from the get-vmswitchteam and get-netadapter output comparison.
What I'd like to achieve:
- Check the name of the Get-VMSwitchTeam members
- Check those names are up or down in the output of the get-netadapter
- If not up, alert
However I can't refer to the object inside the array so I can't compare the values between the get-netadapter and get-vmswitchteam. I've used to use the Get-NetLbfoTeamMember but this doesn't have any output in my new system.
This is the adapters in the teaming:
$adapters=(Get-VMSwitchTeam -Name "Teaming"|Select-Object NetAdapterInterfaceDescription)
$adapters
NetAdapterInterfaceDescription
------------------------------
{HPE FlexFabric 10Gb 4-port 536FLR-T Adapter #4, HPE FlexFabric 10Gb 4-port 536FLR-T Adapter #2}
One interface is down (disabled):
get-netadapter
Name InterfaceDescription ifIndex Status MacAddress LinkSpeed
---- -------------------- ------- ------ ---------- ---------
Embedded FlexibleLOM ...2 HPE FlexFabric 10Gb 4-port 536FLR-...#2 10 Disabled 08-xxx-62 10 Gbps
Embedded FlexibleLOM ...1 HPE FlexFabric 10Gb 4-port 536FLR-...#4 11 Up 08-xxx-60 10 Gbps
If I use
$adapters -split ","
I got this which is not the name of interface:
@{NetAdapterInterfaceDescription=System.String[]}
How can I get the list of the interfaces in get-vmswitchteam that I can use with some if statement to compare with get-netadapter?
If I try to refer to the object in the array like $adapters[1] ... it shows the character at that position which I guess okay, but that is not I'd like to achieve.
Thank you for your help