Start-SCVirtualMachine
Starts a virtual machine managed by VMM.
Syntax
Start-SCVirtualMachine
[-VM] <VM>
[-RunAsynchronously]
[-PROTipID <Guid>]
[-JobVariable <String>]
[-OnBehalfOfUser <String>]
[-OnBehalfOfUserRole <UserRole>]
[<CommonParameters>]
Description
The Start-SCVirtualMachine cmdlet starts one or more virtual machines on hosts managed by Virtual Machine Manager (VMM) when the machines are in a stopped state. This cmdlet restores a stopped virtual machine to a running state, and returns an object that represents it in a running state. After you start the virtual machine, you can resume activity on that virtual machine.
If you run this cmdlet on a virtual machine that is already running, it returns the object but does not change the state of the virtual machine.
To stop a running virtual machine, use the Stop-SCVirtualMachine cmdlet.
Examples
Example 1: Start a virtual machine that is turned off
PS C:\> $VM = Get-SCVirtualMachine -Name "VM01"
PS C:\> Start-SCVirtualMachine -VM $VM
The first command gets the virtual machine object named VM01, and then stores that object in the $VM variable.
The second command starts the virtual machine stored in $VM, and displays information about the running virtual machine object.
Example 2: Start all virtual machines that are turned off
PS C:\> $VMs = Get-SCVirtualMachine -VMMServer "VMMServer01.Contoso.com" | where { $_.Status -eq "PowerOff" }
PS C:\> $VMs | Start-SCVirtualMachine
The first command gets all virtual machine objects on VMMServer01 that are in a stopped state, and stores those objects in the $VMs array.
The second command passes each virtual machine in $VMs to the current cmdlet, which starts each virtual machine.
Parameters
-JobVariable
Specifies a variable in which job progress is tracked and stored.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-OnBehalfOfUser
Specifies a user name. This cmdlet operates on behalf of the user that this parameter specifies.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-OnBehalfOfUserRole
Specifies a user role. To obtain a user role, use the Get-SCUserRole cmdlet. This cmdlet operates on behalf of the user role that this parameter specifies.
Type: | UserRole |
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 |
-VM
Specifies a virtual machine object.
Type: | VM |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Outputs
VirtualMachine
Notes
- This cmdlet requires a virtual machine object, which can be retrieved by using the Get-SCVirtualMachinecmdlet.