I am writing a script this is applying on hosts but it ask question and need to respond it so how can set it to respond Y
Write-Output "40- esxi-7.shell-disable" | Green
Get-VMHost | Get-VMHostService -VMHost * | where {$_.Key -eq 'TSM'} | Set-VMHostService -Policy Off
Get-VMHost | Get-VMHostService -VMHost * | where {$_.Key -eq 'TSM'} | Stop-VMHostService
For example it shows follow :
PS C:\Users\Administrator> Get-VMHostService -VMHost * | where {$_.Key -eq 'TSM'} | Stop-VMHostService
Perform operation?
Perform operation Stop host service. on ESXi Shell?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
I want it set auto answer Y
As this post also needs moving to the area for PowerCLI, I have also reported it to the volunteer moderators.
Add the -Confirm:$false switch on the Stop-VMHostService cmdlet
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Did this answer your question?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
