Stop-SCService

Stops a VMM service and all virtual machines within the service.

Syntax

Stop-SCService
    [-VMMServer <ServerConnection>]
    [-Service] <Service>
    [-RunAsynchronously]
    [-PROTipID <Guid>]
    [-JobVariable <String>]
    [-OnBehalfOfUser <String>]
    [-OnBehalfOfUserRole <UserRole>]
    [<CommonParameters>]
Stop-SCService
    [-VMMServer <ServerConnection>]
    [-Service] <Service>
    [-SaveState]
    [-RunAsynchronously]
    [-PROTipID <Guid>]
    [-JobVariable <String>]
    [-OnBehalfOfUser <String>]
    [-OnBehalfOfUserRole <UserRole>]
    [<CommonParameters>]
Stop-SCService
    [-VMMServer <ServerConnection>]
    [-Service] <Service>
    [-DiscardSavedState]
    [-RunAsynchronously]
    [-PROTipID <Guid>]
    [-JobVariable <String>]
    [-OnBehalfOfUser <String>]
    [-OnBehalfOfUserRole <UserRole>]
    [<CommonParameters>]
Stop-SCService
    [-VMMServer <ServerConnection>]
    [-Service] <Service>
    [-Shutdown]
    [-RunAsynchronously]
    [-PROTipID <Guid>]
    [-JobVariable <String>]
    [-OnBehalfOfUser <String>]
    [-OnBehalfOfUserRole <UserRole>]
    [<CommonParameters>]

Description

The Stop-SCService cmdlet stops a Virtual Machine Manager (VMM) service and all virtual machines within the service. To start a service, use the Start-SCService cmdlet.

Examples

Example 1: Stop a specific service

PS C:\> $Service = Get-SCService -Name "Service01"
PS C:\> Stop-SCService -Service $Service

The first command gets the service object named Service01 and stores the object in the $Service variable.

The second command stops the service in $Service, which stops all of the virtual machines in the service.

Parameters

-DiscardSavedState

Indicates that this cmdlet deletes the saved state associated with a service.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-JobVariable

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

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

-SaveState

Saves the state of a virtual machine or service.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Service

Specifies a VMM service object.

Type:Service
Position:0
Default value:None
Required:True
Accept pipeline input:True
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.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-VMMServer

Specifies a VMM server object.

Type:ServerConnection
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

Outputs

VirtualMachine[]

This cmdlet returns an array of VirtualMachine objects.