Delen via


Reset-SCVirtualMachine

Resets a virtual machine by powering off the virtual machine and then starting it.

Syntax

Reset-SCVirtualMachine
     [-VM] <VM>
     [-RunAsynchronously]
     [-PROTipID <Guid>]
     [-JobVariable <String>]
     [-OnBehalfOfUser <String>]
     [-OnBehalfOfUserRole <UserRole>]
     [<CommonParameters>]

Description

The Reset-SCVirtualMachine cmdlet resets a virtual machine by powering off the virtual machine and then starting it. This is the equivalent of using the Stop-SCVirtualMachine and Start-SCVirtualMachine cmdlets. To use this cmdlet, the virtual machine must be in a running state.

Examples

Example 1: Reset a virtual machine

PS C:\> $VM = Get-SCVirtualMachine -Name "VM01"
PS C:\> Reset-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 resets the virtual machine stored in $VM.

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 VMM virtual machine object, which can be retrieved by using the Get-SCVirtualMachine cmdlet.