VMware Cloud Community
habs3
Enthusiast
Enthusiast
Jump to solution

Script no returning empty

Hi

the following is not returning correctly. I was wondering if there was actual data but not being shown? It always comes back as "Nic Teaming Configured Properly" weather i have a nic in standby mode or not.

Any help would be appreciated.

Thank you

$esxhst = "Hostname"

$NicTeaming = Get-VirtualSwitch -VMHost $esxhst | Get-NicTeamingPolicy

if ( $NicTeaming.standbyNic -and $NicTeaming.UnusedNic -Eq $Null )

{

$NicTeamPolicy = "Nic Teaming Configured Properly"

}

else

{ $NicTeamPolicy = "Nic Teaming NOT Configured properly" }

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Not sure if the expression is what you actually want.
Don't you want to check if there no standby nor unused NICs?

Then that line should probably be

if ( $NicTeaming.standbyNic -eq $null -and $NicTeaming.UnusedNic -Eq $Null )


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

Not sure if the expression is what you actually want.
Don't you want to check if there no standby nor unused NICs?

Then that line should probably be

if ( $NicTeaming.standbyNic -eq $null -and $NicTeaming.UnusedNic -Eq $Null )


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
habs3
Enthusiast
Enthusiast
Jump to solution

Thank you so much. That was it. It now returns the correct response.

Thanks again...

0 Kudos