Get-SCJob

Gets VMM job objects.

Syntax

Get-SCJob [[-Name] <String>] [-All] [-Full] [-ID <Guid>] [-Job <Task>] [-OnBehalfOfUser <String>]
 [-OnBehalfOfUserRole <UserRole>] [-VMMServer <ServerConnection>] [<CommonParameters>]
Get-SCJob [[-Name] <String>] [-Full] [-ID <Guid>] [-Job <Task>] [-Newest <Int32>] [-OnBehalfOfUser <String>]
 [-OnBehalfOfUserRole <UserRole>] [-VMMServer <ServerConnection>] [<CommonParameters>]
Get-SCJob [[-Name] <String>] [-OnBehalfOfUser <String>] [-OnBehalfOfUserRole <UserRole>] [-Running]
 [-VMMServer <ServerConnection>] [<CommonParameters>]

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 demonstrate how to use job groups, see the following cmdlets: New-SCVMTemplate, New-SCHardwareProfile, New-SCVirtualDiskDrive, New-SCVirtualDVDDrive, New-SCVirtualMachine, and Set-SCVirtualCOMPort.

Examples

Example 1: Get all running jobs

PS C:\> Get-Job -Running

This command retrieves all running jobs.

Example 2: Get all failed jobs

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

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, which stores the name, ID, and Status in the $VMMJobs variable.

The second command displays the information stored in $VMMJobs to the user (in this case, that is the name, ID, and Status of each running job).

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

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

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

Parameters

-All

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

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

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

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

Specifies the numerical identifier as a globally unique identifier, or GUID, for a specific object.

Type:Guid
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Job

Specifies a VMM job object.

Type:Task
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Name

Specifies the name of a VMM object.

Type:String
Required:False
Position:0
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Newest

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

Type:Int32
Required:False
Position:Named
Default value:None
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
Required:False
Position:Named
Default value:None
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
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Running

Indicates that all running jobs are returned.

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

Specifies a VMM server object.

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

Outputs

Job

This cmdlet returns a **Job** object.