habs3
Enthusiast
Enthusiast

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" }

Reply
0 Kudos
LucD
Leadership
Leadership

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

Reply
0 Kudos
habs3
Enthusiast
Enthusiast

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

Thanks again...

Reply
0 Kudos