Partager via


Get-SCJob

Get-SCJob

Gets VMM job objects.

Syntax

Parameter Set: NewestJobs
Get-SCJob [[-Name] <String> ] [-Full] [-ID <Guid]> ] [-Job <Task> ] [-Newest <Int32> ] [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: AllJobs
Get-SCJob [[-Name] <String> ] -All [-Full] [-ID <Guid]> ] [-Job <Task> ] [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Parameter Set: RunningJobs
Get-SCJob [[-Name] <String> ] -Running [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Detailed Description

The Get-SCJob cmdlet gets one or more Virtual Machine Manager (VMM) job objects on the VMM server. A job is a series of steps that are performed sequentially to complete an action in the VMM environment. You can retrieve job objects based on specified criteria.

In VMM, you can group a series of jobs and run them together as a set. For example, a complex action in VMM, such as creating a template, might incorporate a series of jobs, known as a job group. For examples that show you how to use job groups, see the following cmdlets: New-SCVMTemplate, New-SCHardwareProfile, New-SCVirtualDiskDrive, New-SCVirtualDVDDrive, New-SCVirtualMachine, and Set-SCVirtualCOMPort.

Parameters

-All

Indicates that this cmdlet retrieves a full list of all subordinate objects independent of the parent object. For example, the command Get-SCVirtualDiskDrive -All retrieves all virtual disk drive objects regardless of the virtual machine object or template object that each virtual disk drive object is associated with.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Full

Indicates that this cmdlet returns the job object with an audit record.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ID<Guid]>

Specifies the numerical identifier as a globally unique identifier (GUID) for a specific object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Job<Task>

Specifies a VMM job object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Name<String>

Specifies the name of a VMM object.

Aliases

none

Required?

false

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Newest<Int32>

Returns all jobs created in the last specified number of hours, or returns the specified number of most recent software updates.

Example format to return all jobs created in the last 48 hours: Get-SCJob -Newest 48

Example format to return the 10 newest updates: Get-SCUpdate -Newest 10

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-OnBehalfOfUser<System.String>

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-OnBehalfOfUserRole<Microsoft.SystemCenter.VirtualMachineManager.UserRole>

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Running

Indicates that all running jobs are returned.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VMMServer<ServerConnection>

Specifies a VMM server object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

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

Examples

Example 1: Get all running jobs

This command retrieves all running jobs.

PS C:\> Get-Job -Running

Example 2: Get all failed jobs

The first command gets all job objects with a status of Failed, and then uses the pipeline operator to pass each object to the Format-List cmdlet. The command stores the name, ID, and Status in the $VMMJobs variable.

The second command displays the information stored in $VMMJobs. In this case, the command displays the name, ID, and Status of each running job.

PS C:\> $VMMJobs = Get-SCJob | where { $_.Status -eq "Failed" } | Format-List -Property Name, ID, Status
PS C:\> $VMMJobs

Example Example 3: Get information about the .NET type, methods, and properties of VMM job objects.

This command uses the Get-Member cmdlet to display the .NET type, properties, methods, and events for the job objects that Get-SCJob gets.

PS C:\> Get-SCJob | Get-Member

Find-SCJob

Get-SCStep

New-SCHardwareProfile

New-SCVirtualDiskDrive

New-SCVirtualDVDDrive

New-SCVirtualMachine

New-SCVMTemplate

Restart-SCJob

Set-SCVirtualCOMPort

Stop-SCJob