This is the built-in help made by Microsoft for the command 'New-ScheduledTask', in PowerShell version 5 - as retrieved from
Windows version 'Microsoft Windows Server 2012 R2 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.
Creates a scheduled task instance.
New-ScheduledTask [[-Action] <CimInstance>] [[-Trigger] <CimInstance>] [[-Settings] <CimInstance>] [[-Principal] <CimInstance>] [[-Description] <String>] [-AsJob]
[-CimSession <CimSession>] [-ThrottleLimit <Int32>] [<CommonParameters>]
The New-ScheduledTask cmdlet creates an object that contains the definition of a scheduled task. New-ScheduledTask does not automatically register the object with the Task
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.
Online Version: http://go.microsoft.com/fwlink/p/?linkid=287551
Example 1: Define a scheduled task and register it at a later time
PS C:\> $A = New-ScheduledTaskAction –Execute "Taskmgr.exe"
PS C:\> $T = New-ScheduledTaskTrigger -AtLogon
PS C:\> $P = "Contoso\Administrator"
PS C:\> $S = New-ScheduledTaskSettingsSet
PS C:\> $D = New-ScheduledTask -Action $A -Principal $P -Trigger $T -Settings $S
PS C:\> Register-ScheduledTask T1 -InputObject $D
In this example, the set of commands uses several cmdlets and variables to define and then register a scheduled task.
The first command uses the New-ScheduledTaskAction cmdlet to assign the variable $A to the executable file tskmgr.exe.
The second command uses the New-ScheduledTaskTrigger cmdlet to assign the variable $T to the value AtLogon.
The third command assigns the variable $P to the principal of the scheduled task, Contoso\Administrator.
The fourth command uses the New-ScheduledTaskSettingsSet cmdlet to assign the variable $S to a task settings object.
The fifth command creates a new task and assigns the variable $D to the task definition.
The sixth command (hypothetically) runs at a later time. It registers the new scheduled task and defines it by using the $D variable.