This script traverses all clusters and host and check if Beacon Probing is set the NetworkFailoverDetectionPolicy. If Beacon Probing is set, change it to Link Status.
#import-module VMware.VimAutomation.Core
#Connect-VIServer -Server vcenter_hostname
#uncomment for testing
#$vmhosts = "hostname1","hostname2"
#uncomment for live run
#get the hostnames of all the hosts in every cluster
$vmhosts = get-cluster | get-vmhost | select name
foreach($vmhost in $vmhosts)
{
#Gets all the vSwitch names that has beacon probing set on the host.
$switch_policy = Get-VirtualSwitch -VMHost $vmhost.Name | where {$_.Name -ne "vSwitchiDRACvusb"} | Get-NicTeamingPolicy | Where-Object {$_.NetworkFailoverDetectionPolicy -eq "BeaconProbing"} | select -ExpandProperty VirtualSwitch # | select VirtualSwitch | format-wide
if ($switch_policy)
{
foreach ($switch in $switch_policy)
{
$vs = Get-VirtualSwitch -VMHost $vmhost.Name -Name $switch
Get-NicTeamingPolicy -VirtualSwitch $vs | Set-NicTeamingPolicy -NetworkFailoverDetectionPolicy LinkStatus
}
}
#Gets all the port group names that has beacon probing set on the host.
$portgroup_policy = Get-VirtualPortGroup -VMHost $vmhost | Get-NicTeamingPolicy | Where-Object {$_.NetworkFailoverDetectionPolicy -eq "BeaconProbing"} | select -ExpandProperty VirtualPortGroup
if ($portgroup_policy)
{
foreach ($p in $portgroup_policy)
{
#Sets the nicteamingpolicy from the host and its portgroup.
$vpg = Get-VirtualPortGroup -VMHost $vmhost.Name -Name $p
Get-NicTeamingPolicy -VirtualPortGroup $vpg | Set-NicTeamingPolicy -NetworkFailoverDetectionPolicy LinkStatus
}
}
}