Power CLI -Autodeploy - Adding Autodeploy Rules for Hosts in out-of-service Cluster




  1. Put the ESXi hosts into the out-of-service cluster
  2. 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://repo.mhint/esxi/ESXi-5.0.0-20131101001
$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

Popular posts from this blog

Using Non-Maskable Interrupt (NMI) facilities to troubleshoot unresponsive VMware Virtual Machine.

Removing invalid linked clone entries automatically using the ViewDBChk tool

VMTool update steps on Horizon VDI Parent VM