Partager via


Disable-SCVMHost

Disable-SCVMHost

Puts a virtual machine host into maintenance mode.

Syntax

Parameter Set: NoVMMigration
Disable-SCVMHost [-VMHost] <Host> [-JobVariable <String> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [ <CommonParameters>]

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

Detailed Description

The Disable-SCVMHost cmdlet puts 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 use either of the following methods:

-- Migrate highly available virtual machines and save the other virtual machines. When you use the MoveWithinCluster parameter with Disable-SCVMHost, the cmdlet uses Live Migration to migrate all running highly available virtual machines to other hosts in the cluster. It puts the running virtual machines that are not highly available into a saved state, which causes users to lose service. Then, it puts the host into maintenance mode.
-- Save all the virtual machines. Disable-SCVMHost puts all the running virtual machines into a saved state, which causes users to lose service. Then, it puts 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 puts all of the running virtual machines into a saved state, which causes users to lose service. Then, it puts the host into maintenance mode. When you put a VMware ESX host into maintenance mode using Disable-SCVMHost, VMM sends a request to enter maintenance mode to the VMware vCenter Server that manages that host. The vCenter Server puts the ESX host into maintenance mode.

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 put 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 use either of the following methods:

-- Migrate highly available virtual machines and save the other virtual machines. When you use the MoveWithinCluster parameter 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 puts all the running virtual machines that are not highly available into a saved state, which causes users to lose service. Then, it puts the host into maintenance mode.
-- Save all the virtual machines. Disable-SCVMHost puts all the running virtual machines into a saved state, which causes users to lose service. Then, it puts 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 puts all of the running virtual machines into a saved state, which causes users to lose service. Then, it puts the host into maintenance mode.

After you put 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.

Parameters

-JobVariable<String>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PROTipID<Guid]>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RunAsynchronously

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VMHost<Host>

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, type Get-Help Add-SCVMHost -detailed.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Host
  • Host[]

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.

Examples

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

The first command gets the host object named VMHost01, and then 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.

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

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

The first command gets the host object named VMHost02, and then 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.

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

Add-SCVMHost

Enable-SCVMHost

Get-SCVMHost

Move-SCVMHost

New-SCVMHost

Read-SCVMHost

Register-SCVMHost

Remove-SCVMHost

Repair-SCVMHost

Restart-SCVMHost

Set-SCVMHost

Start-SCVMHost

Stop-SCVMHost

Move-SCVirtualMachine