Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 176561

automate patching of selected esx hosts

$
0
0

tryijg to automate the patching of esx hosts

 

reading them from a txt file, putting one at a time in maintenance mode, scan, patchin, reboot, then next host

 

will this work?

 

import-module Vmware.VimAutomation.Core

import-module Vmware.Vumautomation

 

$vmhosts = get-vmhost -name (get-content "c:\scripts\vmhosts.txt") {

 

foreach ($vmhost in $vmhosts) {

 

get-vmhost -Name $vmhost | Set-VMHost -State Maintenance -Confirm:$false

 

Get-Baseline -Name *Critical* | Attach-Baseline -entity $vmhost -Confirm:$false

 

Scan-Inventory -Entity $vmhost

 

get-baseline -name *Critical* | Remediate-Inventory -Entity $vmhost -Confirm:$false -erroraction Silentlycontinue

 

get-vmhost -name $vmhost | set-vmhost -state Connected -Confirm:$false

}

 

 

anything I can tweak or should be aware of?

 

Thanks


Viewing all articles
Browse latest Browse all 176561

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>