Come and Check our BETA Alpha version of Powershellcenter.net
Send me your comment to Powershell@powershellcenter.com

Synopsis

Stops virtual machines managed by VMM.

Syntax

Stop-SCVirtualMachine [-VM] <String VirtualMachine> [-DiscardSavedState <SwitchParameter>] [-JobVariable <String>] [-PROTipID <Guid>] [-RunAsynchronously <SwitchParameter>] [<CommonParameters>]

Stop-SCVirtualMachine [-VM] <String VirtualMachine> [-JobVariable <String>] [-PROTipID <Guid>] [-RunAsynchronously <SwitchParameter>] [-SaveState <SwitchParameter>] [<CommonParameters>]

Stop-SCVirtualMachine [-VM] <String VirtualMachine> [-Force <SwitchParameter>] [-JobVariable <String>] [-PROTipID <Guid>] [-RunAsynchronously <SwitchParameter>] [<CommonParameters>]

Stop-SCVirtualMachine [-VM] <String VirtualMachine> [-JobVariable <String>] [-PROTipID <Guid>] [-RunAsynchronously <SwitchParameter>] [<CommonParameters>]

Stop-SCVirtualMachine [-VM] <String VirtualMachine> [-JobVariable <String>] [-PROTipID <Guid>] [-RunAsynchronously <SwitchParameter>] [-Shutdown <SwitchParameter>] [<CommonParameters>]

Detailed Description

The Stop-SCVirtualMachine cmdlet stops one or more running virtual machines on hosts managed by System Center Virtual Machine Manager (VMM) and returns the virtual machine object in a stopped state. Stop-SCVirtualMachine stops a virtual machine in the same manner as shutting down the operating system on a computer. Stop-SCVirtualMachine with the Force parameter stops a virtual machine in the same manner as turning off a computer. To resume running a stopped virtual machine, use the Start-SCVirtualMachine cmdlet. For more information about Stop-SCVirtualMachine, type: "Get-Help Stop-SCVirtualMachine -online".

Parameters

-VM [<>]

Specifies a virtual machine object.

Required?   true
Position?   0
Default value?  
Accept pipeline input?   true (ByValue)
Accept wildcard characters?   false

-DiscardSavedState [<>]

Deletes the saved state associated with a virtual machine or service.

Required?   false
Position?   named
Default value?  
Accept pipeline input?   false
Accept wildcard characters?   false

-Force [<>]

Forces the operation to complete.

For example:

- Remove-SCSCVMHost -Force

Forces the removal of a host object from the VMM database.

- Stop-SCVirtualMachine -Force

Stops a virtual machine.

Required?   false
Position?   named
Default value?  
Accept pipeline input?   false
Accept wildcard characters?   false

-JobVariable [<>]

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

Required?   false
Position?   named
Default value?  
Accept pipeline input?   false
Accept wildcard characters?   false

-PROTipID [<>]

Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.

Required?   false
Position?   named
Default value?  
Accept pipeline input?   false
Accept wildcard characters?   false

-RunAsynchronously [<>]

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

Required?   false
Position?   named
Default value?  
Accept pipeline input?   false
Accept wildcard characters?   false

-SaveState [<>]

Saves the state of a virtual machine or service.

Required?   false
Position?   named
Default value?  
Accept pipeline input?   false
Accept wildcard characters?   false

-Shutdown [<>]

Indicates that a virtual machine, service, or a source server should be shut down. In the case of a virtual machine or service, the associated cmdlet attempts to use the operating system to shut the virtual machine down gracefully. In the case of a successful physical-to-virtual machine (P2V) conversion, the cmdlet shuts down the source server.

Required?   false
Position?   named
Default value?  
Accept pipeline input?   false
Accept wildcard characters?   false

Return Type

VirtualMachine

Notes

Requires a virtual machine object, which can be retrieved by using the Get-SCVirtualMachine cmdlet.

Examples

1: Stop a specified virtual machine.

PS> PS C:\> $VM = Get-SCVirtualMachine -Name "VM01" PS C:\> Stop-SCVirtualMachine -VM $VM

The first command gets the virtual machine object named VM01 and stores the object in the $VM variable. This example assumes that only one virtual machine named VM01 exists and that it is currently in a running state.

The second command stops the virtual machine stored in $VM (in this case, VM01) and displays information about the stopped object to the user.

2: Stop multiple virtual machines.

PS> PS C:\> $VMs = Get-SCVirtualMachine | where { $_.Name -match "VM" -and $_.Status -eq "Running" } PS C:\> $VMs | Stop-SCVirtualMachine

The first command gets all virtual machine objects whose name contains the string VMM and whose current status is "Running". The command then stores those objects in the $VMs variable.

The second command passes each virtual machine object stored in $VMs to Stop-VM, which stops each virtual machine and displays information about the stopped virtual machines to the user.

Synopsis

Stops virtual machines managed by VMM.

Syntax

Stop-SCVirtualMachine [-VM] <String VirtualMachine> [-DiscardSavedState <SwitchParameter>] [-JobVariable <String>] [-PROTipID <Guid>] [-RunAsynchronously <SwitchParameter>] [<CommonParameters>]

Stop-SCVirtualMachine [-VM] <String VirtualMachine> [-JobVariable <String>] [-PROTipID <Guid>] [-RunAsynchronously <SwitchParameter>] [-SaveState <SwitchParameter>] [<CommonParameters>]

Stop-SCVirtualMachine [-VM] <String VirtualMachine> [-Force <SwitchParameter>] [-JobVariable <String>] [-PROTipID <Guid>] [-RunAsynchronously <SwitchParameter>] [<CommonParameters>]

Stop-SCVirtualMachine [-VM] <String VirtualMachine> [-JobVariable <String>] [-PROTipID <Guid>] [-RunAsynchronously <SwitchParameter>] [<CommonParameters>]

Stop-SCVirtualMachine [-VM] <String VirtualMachine> [-JobVariable <String>] [-PROTipID <Guid>] [-RunAsynchronously <SwitchParameter>] [-Shutdown <SwitchParameter>] [<CommonParameters>]

Detailed Description

The Stop-SCVirtualMachine cmdlet stops one or more running virtual machines on hosts managed by System Center Virtual Machine Manager (VMM) and returns the virtual machine object in a stopped state. Stop-SCVirtualMachine stops a virtual machine in the same manner as shutting down the operating system on a computer. Stop-SCVirtualMachine with the Force parameter stops a virtual machine in the same manner as turning off a computer. To resume running a stopped virtual machine, use the Start-SCVirtualMachine cmdlet. For more information about Stop-SCVirtualMachine, type: "Get-Help Stop-SCVirtualMachine -online".

Parameters

-VM [<>]

Specifies a virtual machine object.

Required?   true
Position?   0
Default value?  
Accept pipeline input?   true (ByValue)
Accept wildcard characters?   false

-DiscardSavedState [<>]

Deletes the saved state associated with a virtual machine or service.

Required?   false
Position?   named
Default value?  
Accept pipeline input?   false
Accept wildcard characters?   false

-Force [<>]

Forces the operation to complete.

For example:

- Remove-SCSCVMHost -Force

Forces the removal of a host object from the VMM database.

- Stop-SCVirtualMachine -Force

Stops a virtual machine.

Required?   false
Position?   named
Default value?  
Accept pipeline input?   false
Accept wildcard characters?   false

-JobVariable [<>]

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

Required?   false
Position?   named
Default value?  
Accept pipeline input?   false
Accept wildcard characters?   false

-PROTipID [<>]

Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.

Required?   false
Position?   named
Default value?  
Accept pipeline input?   false
Accept wildcard characters?   false

-RunAsynchronously [<>]

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

Required?   false
Position?   named
Default value?  
Accept pipeline input?   false
Accept wildcard characters?   false

-SaveState [<>]

Saves the state of a virtual machine or service.

Required?   false
Position?   named
Default value?  
Accept pipeline input?   false
Accept wildcard characters?   false

-Shutdown [<>]

Indicates that a virtual machine, service, or a source server should be shut down. In the case of a virtual machine or service, the associated cmdlet attempts to use the operating system to shut the virtual machine down gracefully. In the case of a successful physical-to-virtual machine (P2V) conversion, the cmdlet shuts down the source server.

Required?   false
Position?   named
Default value?  
Accept pipeline input?   false
Accept wildcard characters?   false

Return Type

VirtualMachine

Notes

Requires a virtual machine object, which can be retrieved by using the Get-SCVirtualMachine cmdlet.

Examples

1: Stop a specified virtual machine.

PS> PS C:\> $VM = Get-SCVirtualMachine -Name "VM01" PS C:\> Stop-SCVirtualMachine -VM $VM

The first command gets the virtual machine object named VM01 and stores the object in the $VM variable. This example assumes that only one virtual machine named VM01 exists and that it is currently in a running state.

The second command stops the virtual machine stored in $VM (in this case, VM01) and displays information about the stopped object to the user.

2: Stop multiple virtual machines.

PS> PS C:\> $VMs = Get-SCVirtualMachine | where { $_.Name -match "VM" -and $_.Status -eq "Running" } PS C:\> $VMs | Stop-SCVirtualMachine

The first command gets all virtual machine objects whose name contains the string VMM and whose current status is "Running". The command then stores those objects in the $VMs variable.

The second command passes each virtual machine object stored in $VMs to Stop-VM, which stops each virtual machine and displays information about the stopped virtual machines to the user.