Then you should place the following lines inside the block for $options -eq 1
Now it is always executed, whatever the value in $options
Get-Cluster -Name $clusterName | Get-VM |
ForEach-Object -Process {
Get-VMHost $hostname | New-AdvancedSetting -Entity $_ -Name log.keepOld -Value '10' -Confirm:$false -Force
Get-VMHost $hostname | New-AdvancedSetting -Entity $_ -Name RemoteDisplay.maxConnections -Value '1' -Confirm:$false -Force
Get-VMHost $hostname | New-AdvancedSetting -Entity $_ -Name log.rotateSize -Value '2048000' -Confirm:$false -Force
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference