TestimoX

API Reference

Command

Invoke-CxHyperVVmStateChange

Namespace ComputerX.PowerShell
Inputs
System.String System.String[]
Outputs
ComputerX.HyperV.HyperVVirtualMachineStateChangePlan ComputerX.HyperV.HyperVVirtualMachineStateChangeResult

Invokes a native Hyper-V virtual machine state change through the Hyper-V WMI v2 provider.

Examples

Authored help example

Example 1: Preview a graceful shutdown request.

PS>


Invoke-CxHyperVVmStateChange -Name DC01 -Action Shutdown -Preview
        

Example 2: Start a selected VM and wait for the returned Hyper-V job to finish.

PS>


Invoke-CxHyperVVmStateChange -Name Lab01 -Action Start -Wait
        

Example 3: Start a selected VM through native Hyper-V WMI.

PS>


Invoke-CxHyperVVmStateChange -ComputerName HV01 -Name Lab01 -Action Start -Confirm
        

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.

Syntax

Invoke-CxHyperVVmStateChange [-ComputerName <string[]>] -Name <string> -Action <Start> [-JobPollIntervalMilliseconds <int>] [-JobTimeoutSeconds <int>] [-Preview] [-TimeoutSeconds <int>] [-Wait] [<CommonParameters>]
#

Parameters

ComputerName string[] optionalposition: 0pipeline: true (ByPropertyName)
Target computer names. Use . for the local machine or provide DNS/NetBIOS names. When omitted, the local computer is targeted.
Name string requiredposition: 1pipeline: true (ByValue, ByPropertyName)aliases: Id, VMName
Virtual machine friendly name, WMI identity, or wildcard pattern resolving to one VM.
Action HyperVVirtualMachineStateChangeAction requiredposition: 2pipeline: falsevalues: 7
Native Hyper-V state change action. Possible values: Start, Shutdown, TurnOff, Save, Pause, Resume, Reset
Possible values: Start, Shutdown, TurnOff, Save, Pause, Resume, Reset
JobPollIntervalMilliseconds int optionalposition: namedpipeline: false
Optional delay in milliseconds between asynchronous Hyper-V job polls.
JobTimeoutSeconds int optionalposition: namedpipeline: false
Optional timeout in seconds for asynchronous Hyper-V job polling.
Preview SwitchParameter optionalposition: namedpipeline: false
Emits the non-mutating state change plan without invoking WMI.
TimeoutSeconds int optionalposition: namedpipeline: false
Optional WMI timeout in seconds used for VM discovery.
Wait SwitchParameter optionalposition: namedpipeline: false
Waits for an asynchronous Hyper-V job returned by RequestStateChange.

Outputs

ComputerX.HyperV.HyperVVirtualMachineStateChangePlan, ComputerX.HyperV.HyperVVirtualMachineStateChangeResult