I made the following script to update all our hosts. It saves me a lot of time when updating all my hosts because now I can start the script and have just to wait untill all my hosts are updated. Before I had to put a host in maintenance mode, remediate the host and exit maintenance mode. And I had to do this for all my hosts. The script asumes that you use DRS in your clusters to move the VM's when you put a host in maintenance mode:
$Baseline = Get-Baseline -TargetType host
Get-VMhost | ForEach-Object {
Set-VMhost -vmhost $_ -state maintenance
Remediate-Inventory -Entity $_ -Baseline $Baseline -Confirm:$False
Set-VMhost -vmhost $_ -state connected
}
Have fun!
Robert van den Nieuwendijk
Perhaps you should mention that this will only work with cluster nodes when the DRS Automation level is set to "fully automated".
As long as there are active guests, your hosts will not enter maintenance mode.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Luc, thanks for this extra info.
Can you help me?
I do not understand the stages to be realized to update with update manager and powershell, a vm or several vm
My baseline is created.
Thank you in advance
Thank you for your answer
However, I make the update in graphic mode with update manager and the baseline created
But, i'm sorry
I am a greenhorn in powershell.
You would have the commands to be crossed (go) to make the update with the commands powershell of a vm or several vm
Have you examples
Thank you in advance
I see that my script got a little mangled by the forum software. I was quite new to the forum when I posted the script. Will do it better this time ;-).
$Baseline = Get-Baseline -TargetType host
Get-VMhost | ForEach-Object {
Set-VMhost -vmhost $_ -state maintenance
Remediate-Inventory -Entity $_ -Baseline $Baseline -Confirm:$False
Set-VMhost -vmhost $_ -state connected
}
RvdNieuwendijk
$Baseline = Get-Baseline -TargetType host Get-VMhost | ForEach-Object { Set-VMhost -vmhost $_ -state maintenance Remediate-Inventory -Entity $_ -Baseline $Baseline -Confirm:$False Set-VMhost -vmhost $_ -state connected } QQ I have below requirement :
1. On each cluster the all the hosts should be patched, one after the other.
2. Will the above run simultaneously for all host ,( in that case it will result in outage)?
3. I want to apply only "critical & non-critical" patches only ?
4. I would like to skip host which is already patched to latest , will it do that ?
Thanks
