Delen via


Disable-SCVMHost

Places a virtual machine host into maintenance mode.

Syntax

Disable-SCVMHost
       [-VMHost] <Host>
       [-RunAsynchronously]
       [-PROTipID <Guid>]
       [-JobVariable <String>]
       [<CommonParameters>]
Disable-SCVMHost
       [-VMHost] <Host>
       [-MoveWithinCluster]
       [-RunAsynchronously]
       [-PROTipID <Guid>]
       [-JobVariable <String>]
       [<CommonParameters>]

Description

The Disable-SCVMHost cmdlet places a virtual machine host that is managed by Virtual Machine Manager (VMM) into maintenance mode so that you can perform maintenance tasks on the host such as applying security updates or replacing hardware.

You can use the Disable-SCVMHost cmdlet to put individual Hyper-V hosts, VMware ESX hosts, or Citrix XenServer hosts into maintenance mode. You can also use Disable-SCVMHost to put clustered hosts into maintenance mode.

To return the host to service, use the Enable-SCVMHost cmdlet.

To Put Hyper-V Hosts Into Maintenance Mode

If the host belongs to a cluster that supports live migration, you can choose either of the following methods:

Method 1: Migrate highly available virtual machines and save the other virtual machines. When the MoveWithinCluster parameter is used with Disable-SCVMHost, the cmdlet uses Live Migration to migrate all running highly available virtual machines to other hosts in the cluster. It places the running virtual machines that are not highly available into a saved state, which causes users to lose service. Then, it places the host into maintenance mode.

Method 2: Save all the virtual machines. Disable-SCVMHost places all the running virtual machines into a saved state, which causes users to lose service. Then, it places the host into maintenance mode.

If the host does not belong to a cluster, or if it belongs to a cluster that does not support live migration, Disable-SCVMHost places all of the running virtual machines into a saved state, which causes users to lose service. Then, it places the host into maintenance mode.

How Disable-SCVMHost Works with VMWare ESX Hosts

When you place an ESX host into maintenance mode using Disable-SCVMHost, VMM sends a request to enter maintenance mode to the VMware cCenter Server that manages that host. The vCenter Server places the ESX host into maintenance mode.

Note: The system behavior of the virtual machines on the ESX Server host is determined by the configuration of the vCenter Server. For example, if the VMware Distributed Resources Scheduler is not configured, you might have to manually shut down all the virtual machines on the host. Or, you might have to move the virtual machines to another host to successfully place the ESX Server host into maintenance mode.

To Put XenServer Hosts Into Maintenance Mode

If the host belongs to a cluster that supports live migration, you can choose either of the following methods:

Method 1: Migrate highly available virtual machines and save the other virtual machines. When the MoveWithinCluster parameter is used with Disable-SCVMHost, the cmdlet uses XenServer Live Migration to migrate all running highly available virtual machines to other hosts in the cluster. It also places all the running virtual machines that are not highly available into a saved state, which causes users to lose service. Then, it places the host into maintenance mode.

Method 2: Save all the virtual machines. Disable-VMHost places all the running virtual machines into a saved state, which causes users to lose service. Then, it places the host into maintenance mode.

If the host does not belong to a cluster, or if it belongs to a cluster that does not support live migration, Disable-VMHost places all of the running virtual machines into a saved state, which causes users to lose service. Then, it places the host into maintenance mode.

Host Behavior In Maintenance Mode

After you place a host into maintenance mode, the following actions are affected:

  • Virtual machines cannot be created on the host.
  • Virtual machines cannot be migrated to the host.
  • The host is excluded from host ratings calculations performed during virtual machine placement.
  • The host status is not updated.

However, you can perform the following actions:

  • Remove the host from VMM if you make sure that the host is available and that its agent is in an appropriate state.
  • Start or stop virtual machines on the host.
  • Change the host properties.
  • Migrate a virtual machine from the host to another host.

Examples

Example 1: Place the specified host into maintenance mode and save all running virtual machines

PS C:\> $VMHost = Get-SCVMHost -ComputerName "VMHost01" 
PS C:\> Disable-SCVMHost -VMHost $VMHost

The first command gets the host object named VMHost01 and stores the object in the $VMHost variable.

The second command places all running virtual machines that are deployed on the host stored in $VMHost into a saved state. Then it sets the host status to "In Maintenance Mode".

Example 2: Use live migration to migrate all running highly available virtual machines on a cluster node that is in maintenance mode

PS C:\> $VMHost = Get-SCVMHost -ComputerName "VMHost02"
PS C:\> Disable-SCVMHost -VMHost $VMHost -MoveWithinCluster

The first command gets the host object named VMHost02 and stores the object in the $VMHost variable.

The second command uses live migration to migrate all running highly available virtual machines on the host stored in $VMHost to another node in the cluster. It places other running virtual machines into a saved state and then sets the value for the host state property to "In Maintenance Mode".

Parameters

-JobVariable

Specifies that job progress is tracked and stored in the variable named by this parameter.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-MoveWithinCluster

Indicates that all virtual machines currently deployed on a host that is a member of a host cluster will be migrated to another host in the same host cluster if that host is placed into maintenance mode.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PROTipID

Specifies the ID of the Performance and Resource Optimization tip (PRO tip) that triggered this action. This parameter lets you audit PRO tips.

Type:Guid
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RunAsynchronously

Indicates that the job runs asynchronously so that control returns to the command shell immediately.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VMHost

Specifies a virtual machine host object. VMM supports Hyper-V hosts, VMware ESX hosts, and Citrix XenServer hosts.

For more information about each type of host, see the Add-SCVMHost cmdlet.

Type:Host
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Outputs

Host

This cmdlet returns a Host object.

Notes

  • A host that you put into temporary maintenance mode is different from a host that you designate as a maintenance host. A maintenance host is a host that you dedicate for virtual machine maintenance tasks, such as the following:
  • Patching stored virtual machines and templates.
  • Staging scripted virtual machine creation before you move the virtual machines into your production environment.