Stop-SCJob

Stop-SCJob

Stops running VMM jobs.

構文

Parameter Set: Default
Stop-SCJob [-Job] <Task> [-OnBehalfOfUser <System.String> ] [-OnBehalfOfUserRole <Microsoft.SystemCenter.VirtualMachineManager.UserRole> ] [ <CommonParameters>]

詳細説明

The Stop-SCJob cmdlet stops one or more Virtual Machine Manager (VMM) jobs that are running, and returns the object for each job in a stopped state. If the VMM job is not currently running, this cmdlet has no effect.

パラメーター

-Job<Task>

Specifies a VMM job object.

エイリアス

none

必須?

true

位置は?

1

既定値

none

パイプライン入力を許可する

True (ByValue)

ワイルドカード文字を許可する

false

-OnBehalfOfUser<System.String>

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

-OnBehalfOfUserRole<Microsoft.SystemCenter.VirtualMachineManager.UserRole>

エイリアス

none

必須?

false

位置は?

named

既定値

none

パイプライン入力を許可する

false

ワイルドカード文字を許可する

false

<CommonParameters>

このコマンドレットは次の共通パラメーターをサポートします。-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer、-OutVariable.詳細については、以下を参照してください。 about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216)。

入力

入力型は、コマンドレットにパイプできるオブジェクトの型です。

出力

出力型は、コマンドレットによって生成されるオブジェクトの型です。

  • Task

  • This cmdlet requires a VMM job object, which can be retrieved by using the Get-SCJob cmdlet.

Example 1: Stop all currently running jobs

The first command gets all VMM job objects, passes each job object to the where statement to select only the jobs that are currently running, and then stores the objects in the $Job object array.

The second command passes each object in $Job to the Stop-Job cmdlet. That cmdlet stops each running job.

PS C:\> $Job = Get-SCJob | where { $_.Status -eq "Running" }
PS C:\> $Job | Stop-SCJob

Example 2: Stop a specific running job asynchronously

The first command gets all VMM job objects and, from the results, selects only the job on VM01 identified by job ID cb3a0f0a-9fbc-4bd0-a999-3fae8cd77177, and then stores the object in the $Job variable.

The second command stops the job and returns the stopped job object.

PS C:\> $Job = Get-SCJob | where { $_.ResultName -eq "VM01" -and $_.ID -eq "cb3a0f0a-9fbc-4bd0-a999-3fae8cd77177" }
PS C:\> Stop-SCJob -Job $Job

関連トピック

Find-SCJob

Get-SCJob

Restart-SCJob