PowerShell Logo Small

Set-ScheduledTask



This is the built-in help made by Microsoft for the command 'Set-ScheduledTask', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Modifies a scheduled task.

SYNTAX


Set-ScheduledTask [-TaskName] <String> [[-TaskPath] <String>] [[-Action] <CimInstance[]>] [[-Trigger] <CimInstance[]>] [[-Settings]
<CimInstance>] [[-User] <String>] [[-Password] <String>] [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>]
[<CommonParameters>]
Set-ScheduledTask [-TaskName] <String> [[-TaskPath] <String>] [[-Action] <CimInstance[]>] [[-Trigger] <CimInstance[]>] [[-Settings]
<CimInstance>] [[-Principal] <CimInstance>] [-AsJob [<SwitchParameter>]] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>]
[<CommonParameters>]
Set-ScheduledTask [-InputObject] <CimInstance> [[-Password] <String>] [[-User] <String>] [-AsJob [<SwitchParameter>]] [-CimSession
<CimSession[]>] [-ThrottleLimit <Int32>] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Set-ScheduledTask cmdlet modifies a task definition.


You can make changes to a task definition even if an instance of the task is running. The changes do not affect the current instance.



<

RELATED LINKS

Disable-ScheduledTask
Enable-ScheduledTask
Export-ScheduledTask
Get-ScheduledTask
New-ScheduledTask
Register-ScheduledTask
Start-ScheduledTask
Stop-ScheduledTask
Unregister-ScheduledTask
New-ScheduledTaskTrigger
New-ScheduledTaskAction

REMARKS

<

Examples


Example 1: Modify a trigger in a scheduled task

PS C:\>$Time = New-ScheduledTaskTrigger -At 12:00 -OncePS C:\>Set-ScheduledTask –TaskName "SoftwareScan" –Trigger $Time
TaskPath TaskName
-------- --------
\ SoftwareScan



In this example, the first command uses the New-ScheduledTaskTrigger cmdlet to define a time trigger, to which the $Time variable is assigned.

The second command adds (or replaces) the $Time trigger in the scheduled task SoftwareScan.




Example 2: Modify settings in a scheduled task definition

PS C:\>$Act1 = New-ScheduledTaskAction -Execute Notepad.exe
PS C:\>$Act2 = New-ScheduledTaskAction -Execute Calc.exe
PS C:\>Set-ScheduledTask "DeployTools" -Action $A1,$A2
TaskPath TaskName
-------- --------
\ DeployTools



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

In this example, the first command uses the New-ScheduledTaskAction cmdlet to define an action, to which the $A1 variable is assigned.

The second command uses the New-ScheduledTaskAction cmdlet to define a second action, to which the the $A2 variable is assigned.

The third command adds the two actions to the scheduled task DeployTools.