baber
Expert
Expert

Yes . The problem relates to this part that  I resided it between 2 if 

 

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

 

"Please choose an Option to apply configurations:"
"1- Select Host"
"2- Apply on All ESXi Host"

$options= Read-Host "Enter your Number 1/2"
if ( 1 -eq $options )
{

$hostname= read-host "Please enter your hostname"
Write-Output "esxi-7.account-auto-unlock-time"

Get-VMHost $hostname | Get-AdvancedSetting Security.AccountUnlockTime | Set-AdvancedSetting -Value 900


}

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

}
if
( 2 -eq $options )
{
Write-Output "6- esxi-7.account-auto-unlock-time" | Green
Get-VMHost | Get-AdvancedSetting Security.AccountUnlockTime | Set-AdvancedSetting -Value 900


}
else {
Write-Output "Insert correct number" | Red
}

 

How can correct it ?

Please mark helpful or correct if my answer resolved your issue.
Reply
0 Kudos