#list name of servers on which changes required in file
$n = Get-Content "D:\pranay\VMName.txt"
foreach ($b in $n){
#Command will extact details of VM
$vm = Get-VM -Name $b | % {Get-View $_.ID}
$value = New-Object VMware.Vim.VirtualMachineConfigSpec
$value.tools = New-Object VMware.Vim.ToolsConfigInfo
#This is where you mention which policy need to enter ,here we only need to enable checkbox to uprade vmware tools at power cycle. Same has been selected
$value.tools.toolsUpgradePolicy = "upgradeAtPowerCycle"
$vm.ReconfigVM_Task($value)
#Below command will export the policy details of all VMs(updated/yet to be updated) in respective VC in csv format.
get-view -ViewType virtualmachine | select name,@{N='ToolsUpgradePolicy';E={$_.Config.Tools.ToolsUpgradePolicy } } | Export-Csv "D:\ToolsOutput.csv" -UseCulture -NoTypeInformation
}
#or if we only need to export of tasks executed for number of VM then remove last line and add below instead of get-view:
$vm.ReconfigVM_Task($value)| Export-Csv "D:\ToolsOutput.csv" -UseCulture -NoTypeInformation