I've written a script to set a specific parm on my VMs (upgrade vmtools at boot). I've set it up to do this per cluster. I would like to know how to re-code it to run against more than 1 VM at a time. Any help is appreciated.
Connect-VIServer -Server myvCenter -User myUser -Password myPassword
$clusterName = "myCluster"
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfigSpec.Tools = New-Object VMware.Vim.ToolsConfigInfo
## Configure the script to set the automatic tools upgrade parameter on or off
## Only 1 section should be enabled at a time (Comment-UnComment carefully)
## UnComment the next line to turn auto upgrade ON
$vmConfigSpec.Tools.ToolsUpgradePolicy = "UpgradeAtPowerCycle"
## UnComment the next line to turn auto upgrade OFF
## $vmConfigSpec.Tools.ToolsUpgradePolicy = "manual"
Get-Cluster -Name $clusterName | Get-VM | sort Name | %{
$_.Extensiondata.ReconfigVM($vmConfigSpec) ## Could this be coded into multiple threads instead of 1 VM at a time?
Write-Host $_","$? ## Could this be coded into multiple threads instead of 1 VM at a time?
}