Register-ScheduledTask

Register-ScheduledTask

Registers a scheduled task definition on a local computer.

構文

Parameter Set: User
Register-ScheduledTask [-TaskName] <String> [[-TaskPath] <String> ] [-Action] <CimInstance[]> [[-Trigger] <CimInstance[]> ] [[-Settings] <CimInstance> ] [[-User] <String> ] [[-Password] <String> ] [[-RunLevel] <RunLevelEnum> ] [[-Description] <String> ] [-AsJob] [-CimSession <CimSession[]> ] [-Force] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Parameter Set: Object
Register-ScheduledTask [[-TaskName] <String> ] [[-TaskPath] <String> ] [-InputObject] <CimInstance> [[-User] <String> ] [[-Password] <String> ] [-AsJob] [-CimSession <CimSession[]> ] [-Force] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Parameter Set: Principal
Register-ScheduledTask [-TaskName] <String> [[-TaskPath] <String> ] [-Action] <CimInstance[]> [[-Trigger] <CimInstance[]> ] [[-Settings] <CimInstance> ] [[-Principal] <CimInstance> ] [[-Description] <String> ] [-AsJob] [-CimSession <CimSession[]> ] [-Force] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

Parameter Set: Xml
Register-ScheduledTask [-TaskName] <String> [[-TaskPath] <String> ] [-Xml] <String> [[-User] <String> ] [[-Password] <String> ] [-AsJob] [-CimSession <CimSession[]> ] [-Force] [-ThrottleLimit <Int32> ] [ <CommonParameters>]

詳細説明

The Register-ScheduledTask cmdlet registers a scheduled task definition on a local computer.

You can register a task to run any of the following application or file types: Win32 applications, Win16 applications, OS/2 applications, MS-DOS applications, batch files (*.bat), command files (*.cmd), or any properly registered file type.

パラメーター

-Action<CimInstance[]>

Specifies an array of one or more work items for the task to run. If you specify multiple actions, the computer runs them in order. You can specify up to 32 actions.

エイリアス

なし

必須?

true

位置は?

3

既定値

なし

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

false

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

false

-AsJob

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

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

false

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

false

-CimSession<CimSession[]>

リモート セッションまたはリモート コンピューターでコマンドレットを実行します。New-CimSession コマンドレットや Get-CimSession コマンドレットの出力など、コンピューター名またはセッション オブジェクトを入力します。既定値は、ローカル コンピューターで実行中の現在のセッションです。

エイリアス

Session

必須?

false

位置は?

named

既定値

なし

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

false

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

false

-Description<String>

Briefly describes the task.

エイリアス

なし

必須?

false

位置は?

9

既定値

なし

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

false

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

false

-Force

Instructs the cmdlet to perform the operation without prompting for confirmation.

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

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

false

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

false

-InputObject<CimInstance>

このコマンドレットへの入力を指定します。このパラメーターを使用するか、パイプを使用して入力をこのコマンドレットに渡すことができます。

エイリアス

なし

必須?

true

位置は?

3

既定値

なし

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

True (ByValue)

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

false

-Password<String>

Specifies a password for the <run as> user. The password is ignored for the well-known system accounts.

Well-known accounts are: NT AUTHORITY\SYSTEM, NT AUTHORITY\LOCALSERVICE, NT AUTHORITY\NETWORKSERVICE, and the well-known security identifiers (SIDs) for all three accounts.

エイリアス

なし

必須?

false

位置は?

5

既定値

なし

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

false

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

false

-Principal<CimInstance>

Specifies the security context in which a task is run.

エイリアス

なし

必須?

false

位置は?

6

既定値

なし

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

false

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

false

-RunLevel<RunLevelEnum>

Specifies the required privilege level to run tasks that are associated with the principal.

エイリアス

なし

必須?

false

位置は?

8

既定値

なし

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

false

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

false

-Settings<CimInstance>

Specifies a configuration that the Task Scheduler service uses to determine how to run a task.

エイリアス

なし

必須?

false

位置は?

5

既定値

なし

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

false

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

false

-TaskName<String>

Specifies the name of a scheduled task.

エイリアス

なし

必須?

true

位置は?

1

既定値

なし

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

false

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

false

-TaskPath<String>

Specifies the path for a scheduled task in Task Scheduler namespace. You can use \ for the root folder. If you do not specify a path, the cmdlet uses the root folder.

エイリアス

なし

必須?

false

位置は?

2

既定値

なし

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

false

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

false

-ThrottleLimit<Int32>

このコマンドレットを実行するために確立できる最大同時操作数を指定します。このパラメーターを省略するか、値として 0 を入力した場合、Windows PowerShell® では、コンピューターで実行している CIM コマンドレットの数に基づいて、コマンドレットに対する最適なスロットル制限を計算します。スロットル制限は現在のコマンドレットのみに適用され、セッションまたはコンピューターには適用されません。

エイリアス

なし

必須?

false

位置は?

named

既定値

なし

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

false

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

false

-Trigger<CimInstance[]>

Specifies an array of one or more trigger objects that start a scheduled task. A task can have a maximum of 48 triggers.

エイリアス

なし

必須?

false

位置は?

4

既定値

なし

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

false

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

false

-User<String>

Specifies the name of the <run as> user account to use when you run the task.

エイリアス

なし

必須?

false

位置は?

4

既定値

Current user

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

false

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

false

-Xml<String>

Specifies the XML string that contains a task definition.

エイリアス

なし

必須?

true

位置は?

3

既定値

なし

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

True (ByValue)

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

false

<CommonParameters>

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

入力

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

出力

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

  • Microsoft.Management.Infrastructure.CimInstance#MSFT_ScheduledTask

Example 1: Register a scheduled task

In this example, the set of commands uses cmdlets and variables to define and register a scheduled task.

The first command uses the New-ScheduledTaskTrigger cmdlet to assign a time trigger to the $Time variable.

The second command assigns the $User variable to the <run as> user account name (Contoso\Administrator).

The third command assigns the $PS variable to PowerShell.exe. This variable is used to define a task action.

The fourth command registers a scheduled task that is named SoftwareScan in the root folder. The registered task uses the pre-created action and trigger values that are specified by the $Action and $User variables.

PS C:\> $Time = New-ScheduledTaskTrigger -At 12:00 -Once 
PS C:\> $User = "Contoso\Administrator"
PS C:\> $PS = PowerShell.exe
PS C:\> Register-ScheduledTask -TaskName "SoftwareScan" -Trigger $Time -User $User –Action $PS

関連トピック

Get-ScheduledTask

Disable-ScheduledTask

Enable-ScheduledTask

Export-ScheduledTask

New-ScheduledTask

Set-ScheduledTask

Start-ScheduledTask

Stop-ScheduledTask

Unregister-ScheduledTask