Set-VMStartPolicy Command | Vmware PowerCLI Reference

Set-VMStartPolicy

This cmdlet modifies the virtual machine start policy. Start policy defines what happens to virtual machines when the server starts up or stops.

Syntax

Set-VMStartPolicy
-StartPolicy < VMStartPolicy[] >
[-InheritStartDelayFromHost ]
[-InheritStopActionFromHost ]
[-InheritStopDelayFromHost ]
[-InheritWaitForHeartbeatFromHost ]
[-StartAction < VmStartAction > ]
[-StartDelay < Int32 > ]
[-StartOrder < Int32 > ]
[-StopAction < VmStopAction > ]
[-StopDelay < Int32 > ]
[-UnspecifiedStartOrder ]
[-WaitForHeartBeat < Boolean > ]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
StartPolicy VMStartPolicy[] named
  • pipeline
Specifies the virtual machine start policy you want to modify.
optional InheritStartDelayFromHost SwitchParameter named
Indicates that the virtual machine uses the value of the StartDelay parameter of the host.
optional InheritStopActionFromHost SwitchParameter named
Indicates that the virtual machine uses the value of the StopAction parameter of the host.
optional InheritStopDelayFromHost SwitchParameter named
Indicates that the virtual machine uses the value of the StopDelay parameter of the host.
optional InheritWaitForHeartbeatFromHost SwitchParameter named
Indicates that the virtual machine uses the value of the WaitforHeartbeat parameter of the host.
optional StartAction VmStartAction named
Specifies a start action for virtual machines. It can be None or PowerOn.
optional StartDelay Int32 named
Specifies a default start delay in seconds.
optional StartOrder Int32 named
Specifies a number to define the virtual machines start order.
optional StopAction VmStopAction named
Specifies the default action of the virtual machine when the server stops. The valid values are None, Suspend, PowerOff, and GuestShutDown.
optional StopDelay Int32 named
Specifies the default stop delay in seconds.
optional UnspecifiedStartOrder SwitchParameter named
Indicates that no order is defined for starting the virtual machines.
optional WaitForHeartBeat Boolean named
Indicates whether the virtual machine should start after receiving a heartbeat, ignore heartbeats and start after the StartDelay has elapsed ($true), or follow the system default before powering on ($false). When a virtual machine is next in the start order, the system either waits a specified period of time for a virtual machine to power on or it waits until it receives a successful heartbeat from a powered on virtual machine.

Output

VMware.VimAutomation.ViCore.Types.V1.Host.VMStartPolicy.VMStartPolicy

Examples

Example 1

$vmstartpolicy = Get-VMStartPolicy -VM VM

Set-VMStartPolicy -StartPolicy $vmstartpolicy -StartAction PowerOn

Retrieves the start policy of the VM virtual machine and defines that when the server starts, the virtual machine is powered on.

Example 2

Get-VM VM | Get-VMStartPolicy | Set-VMStartpolicy -InheritStopActionFromHost -InheritStopDelayFromHost

Reconfigures the start policy of the VM virtual machine to inherit the values of the StopAction and StopDelay from the host.

Example 3

Get-VM VM | Get-VMStartPolicy | Set-VMStartpolicy -StartAction PowerOn -StartOrder 2 -StartDelay 300 -StopAction GuestShutDown -StopDelay 300

Retrieve the start policy of the specified virtual machine and modify its configuration settings.

Related Commands

VM

This cmdlet retrieves the virtual machines on a vCenter Server system.

This cmdlet moves virtual machines to another location.

This cmdlet creates a new virtual machine.

This cmdlet removes the specified virtual machines from the vCenter Server system.

This cmdlet restarts the specified virtual machines.

This cmdlet modifies the configuration of the virtual machine.

This cmdlet powers on virtual machines.

This cmdlet powers off virtual machines.

This cmdlet suspends virtual machines.

This cmdlet unlocks the specified virtual machine.

VMConsoleWindow

This cmdlet opens a window to the virtual machine's console.

VMGuest

This cmdlet retrieves the guest operating systems of the specified virtual machines.

This cmdlet restarts the virtual machine guest operating systems.

This cmdlet shuts down the specified virtual machine guest OS.

This cmdlet suspends the specified guest operating systems.

VMGuestDisk

This cmdlet retrieves storage volumes as seen by the virtual machines' guest operating systems.

VMGuestFile

This cmdlet copies files and folders from and to the guest OS of the specified virtual machines using VMware Tools.

VMQuestion

This cmdlet retrieves the pending questions for the specified virtual machines.

This cmdlet answers the specified virtual machine question.

VMResourceConfiguration

This cmdlet retrieves information about the resource allocation between the selected virtual machines.

This cmdlet configures resource allocation between the virtual machines.

VMScript

This cmdlet runs a script in the guest OS of each of the specified virtual machines.

VMStartPolicy

This cmdlet retrieves the start policy of the virtual machines on a vCenter Server system.

This cmdlet modifies the virtual machine start policy.