Find-SCJob

Searches for VMM jobs.

Syntax

Find-SCJob
    [-After <DateTime>]
    [-VMMServer <ServerConnection>]
    -MaxCount <Int32>
    [-ObjectID <Guid>]
    [-CriticalFailures <Boolean>]
    [<CommonParameters>]
Find-SCJob
    [-VMMServer <ServerConnection>]
    -MaxCount <Int32>
    [-ObjectID <Guid>]
    [-CriticalFailures <Boolean>]
    [-Recent]
    [<CommonParameters>]

Description

The Find-SCJob cmdlet searches for Virtual Machine Manager (VMM) jobs. You can search for the most recent jobs, jobs after a certain date, or search for a job by its result or target ID.

Examples

Example 1: Find all jobs for the last five hours

PS C:\> $StartTime = (Get-Date) - (New-TimeSpan -Hours 5)
PS C:\> Find-SCJob -MaxCount 25 -After $StartTime

This command searches for all jobs that started within the last five hours. Because the MaxCount parameter value is set to 25, only 25 job objects are displayed.

Example 2: Find recent jobs

PS C:\> Find-SCJob -MaxCount 50 -Recent

This command searches for recent jobs and displays the 50 most recent jobs.

Example 3: Find jobs by ObjectID

PS C:\> $VM = Get-SCVirtualMachine -Name "VM01"
PS C:\> Find-SCJob -MaxCount 10 -ObjectID $VM.Id

The first command gets the virtual machine object named VM01 and stores the object in the $VM variable.

The second command returns up to 10 jobs for the specified virtual machine ID.

Parameters

-After

Specifies a DateTime object for the time after which jobs are retrieved. By default, time is represented in the local time zone. You can pass the DateTime object as UTC for standardized time.

When you specify this parameter, jobs are filtered by the StartTime property and returned from earliest start time to latest start time.

For information about how to get a DateTime object, see the Get-Date cmdlet.

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

-CriticalFailures

Indicates whether to find critical failures only.

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

-MaxCount

Specifies the maximum number of jobs to return.

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

-ObjectID

Specifies the object ID, as a GUID, for a service. This ID is the result object or target object for the returned job.

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

-Recent

Indicates that the most recent jobs are returned. Jobs are returned from latest start time to earliest start time.

Use this parameter with the MaxCount parameter to retrieve only a specified number of jobs.

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

Job

This cmdlet returns a Job object.