How To Config VM Power On Sequence Or Config Delay | Nutanix Community
Skip to main content

My customer ask me about how to config vm power on sequence when start cluster 
Example 
Domain Controllers power on first
Exchange Server power on second
Application Server power on third

My customer have only PE.

Thank you for answer the questions.

This could be accomplished through a powershell script with the Nutanix Cmdlets or with something that accesses the REST API of Prism.


 Please show me how to config please.


Install the Nutanix Powershell Cmdlets from the Prism console on to a system that can access the cluster. And then the script is fairly straight forward.

  1. Connect to cluster
  2. Power on first VM
  3. Wait for a set number for minutes or use a ping command to determine network status
  4. Power on second VM
  5. Repeat steps 3 and 4

Below is some fairly crude code that should work.

[cmdletbinding]
param(
[Parameter(mandatory=$true)][String[]]$VMNames
)

$ntnxpsLoaded = Get-PSSnapin -Name NutanixCmdletsPSSnapin -ErrorAction SilentlyContinue | %($_.Name)
if($ntnxpsLoaded -eq $null) {
Add-PSSnapin -Name NutanixCmdletsPSSnapin
}
Connect-NTNXCluster -Server <DNS/IP> -UserName <acct> -Password (Get-Credential).Password
foreach ($VM in $VMNames) {
Set-NTNXVMPowerOn -vmid (Get-NTNXVM -SearchString $VM).vmid
Start-Sleep -Seconds 300
}