- Put the ESXi hosts into the out-of-service cluster
- Run this power cli script below, which will automatically create auto deploy rules for all hosts in the out-of-service cluster
Save to out-of-service.ps1 and execute:
Add-EsxSoftwareDepot -DepotUrl http:
$prof = Get-EsxImageProfile -Name ESXi-5.0.0-20131101001
$cluster = Get-Cluster -Name out-of-service
foreach ($myHost in get-VMHost -Location out-of-service)
{
# Display the ESXi Host that you are applying the changes to
Write-Host '$myHost = ' $myHost
# lookup the IP address
$esxip = [System.Net.Dns]::GetHostAddresses("$myHost") | Select -ExpandProperty IPAddressToString
# Create the deploy rule
Write-Host 'Adding deploy rule for' $myHost.Name '-' $esxip
New-DeployRule -Name $myHost.Name -Pattern ipv4=$esxip -Item $prof,$cluster
# add it
Add-DeployRule $myHost.Name -At 0
Write-Host 'Deploy rule successfully added for' $myHost.Name '-' $esxip
}
|
Comments
Post a Comment