Export (0) Print
Expand All
Expand Minimize

Restart-SCJob

Updated: September 27, 2012

Applies To: System Center 2012 - Virtual Machine Manager

Restart-SCJob

Restarts a failed or canceled VMM job.

Syntax

Parameter Set: Default
Restart-SCJob [-Job] <Task> [-Credential <VMMCredential> ] [-SkipLastFailedStep] [ <CommonParameters>]




Detailed Description

The Restart-SCJob cmdlet restarts one or more System Center Virtual Machine Manager (VMM) jobs that have failed or that have been canceled by a user. Jobs that are currently running must be canceled before they can be restarted. All restarted jobs start from the last known good checkpoint before a failure or a cancellation (some jobs have only a single checkpoint).

Restarting a job displays the object properties of the job to the user and shows the "Status" property as "Running".

For more informatoin about Restart-SCJob, type: "Get-Help Restart-Job -online".

Parameters

-Credential<VMMCredential>

Specifies a credential object or, for some cmdlets, a Run As account object that contains the user name and password of an account that has permission to perform this action. Or, in the case of Restart-SCJob, has permission to complete a restarted task.

For more information about the PSCredential object, type: "Get-Help Get-Credential".

For more information about Run As accounts, type: "Get-Help New-SCRunAsAccount".


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Job<Task>

Specifies a VMM job object.


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-SkipLastFailedStep

Indicates that the last step that failed will not be rerun when a job is restarted.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Job

Notes

  • Requires a Virtual Machine Manager job, which can be retrieved by using the Get-SCJob cmdlet.

Examples

1: Restart all jobs that were cancelled on a specific virtual machine.

The first command gets the Run As account object named RunAsAccount01 and stores the object in the $Creds variable.

The second command gets all VMM jobs from the VMM database, selects only jobs on virtual machine VM01 that have been cancelled, and then passes each object to the Restart-Job cmdlet, which restarts the jobs using the Run As account supplied in $Creds.


PS C:\> $Creds = Get-SCRunAsAccount -Name "RunAsAccount01"PS C:\> Get-SCJob | where { $_.ResultName -eq "VM01" -and $_.Status -eq "Canceled" } | Restart-SCJob -Credential $Creds

2: Restart a specific job.

The first command gets the Run As account object named RunAsAccount01 and stores the object in the $Creds variable.

The second command gets the VMM job object with ID cb3a0f0a-9fbc-4bd0-a999-3fae8cd77177, and restarts that job using the Run As account supplied in $Creds.


PS C:\> $Creds = Get-SCRunAsAccount -Name "RunAsAccount01"PS C:\> Get-SCJob -ID "cb3a0f0a-9fbc-4bd0-a999-3fae8cd77177" | Restart-SCJob -Credential $Creds

Related topics

 
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft