Delen via


Find-SCJob

Searches for VMM jobs.

Syntax

FindAfter (Default)

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

FindRecent

Find-SCJob
    -MaxCount <Int32>
    [-VMMServer <ServerConnection>]
    [-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.

Parameter properties

Type:DateTime
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FindAfter
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CriticalFailures

Indicates whether to find critical failures only.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MaxCount

Specifies the maximum number of jobs to return.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:Guid
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FindRecent
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-VMMServer

Specifies a VMM server object.

Parameter properties

Type:ServerConnection
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

Job

This cmdlet returns a Job object.