About enabling CDP whut powershell i wrote a script any comment or feedback welcome
To use only to 3.5 and up version of ESX
$VMHosts = Get-VMHost | Sort-Object Name
$User = "root"
$Pswd = "rootpassword"
$plink = "YOUR PLINK LOCATION \plink.exe"
You can download plink.exe from following URL
http://the.earth.li/~sgtatham/putty/latest/x86/plink.exe
$plinkoptions = "-pw $Pswd"
Uncomment for get certificate from ESX hosts
#ForEach ($VMHost in $VMHosts)
#{
$autentication = "echo Y | $plink -l root -pw $Pswd $($VMHost.Name) exit"
# Invoke-Expression -Command $autentication
#}
ForEach ($VMHost in $VMHosts)
{
Get-VirtualSwitch -VMHost $VMHost | Foreach {
$msg = ""
$cmd = 'esxcfg-vswitch -B both '
$remoteCommand = '"' + $cmd + $_.name + '"'
$command = $plink + " " + $plinkoptions + " " + $User + "@" + $VMHost.Name + " " + $remoteCommand
$msg = Invoke-Expression -command $command -ErrorAction SilentlyContinue -Verbose
}
}
Obviusly only fot ESX 3.5 and higher