Share via


Find-SCJob

Find-SCJob

Searches for VMM jobs.

Syntax

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

Parameter Set: FindRecent
Find-SCJob -MaxCount <Int32> -Recent [-CriticalFailures <Boolean> ] [-ObjectID <Guid> ] [-VMMServer <ServerConnection> ] [ <CommonParameters>]

Detailed 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.

Parameters

-After<DateTime>

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 getting a DateTime object, see the Get-Date cmdlet.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CriticalFailures<Boolean>

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-MaxCount<Int32>

Specifies the maximum number of jobs to return.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ObjectID<Guid>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

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 MaxCount to retrieve only a specified number of jobs.

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: Find all jobs for the last five hours

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

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

Example 2: Find recent jobs

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

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

Example Example 3: Find jobs by ObjectID.

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

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

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

Get-SCJob

Restart-SCJob

Stop-SCJob

Get-SCVirtualMachine