-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix (definitions): Revise to use strings instead of here-strings for …
…definition object action command arguments This change will keep the definition object format in line with the design of task scheduler which only accepts a string for task action command arguments. With the discovery made in 31679d2, it is now apparent that single-quotes cannot be used in task action command arguments. The reusability of command argument code is thus limited and renders little use for here-strings. This change also partially reverts changes in 46e51c0.
- Loading branch information
1 parent
dc6413e
commit f3879ac
Showing
7 changed files
with
295 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
182 changes: 91 additions & 91 deletions
182
docs/samples/definitions/scheduledtasks/tasks.sample.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,163 +1,163 @@ | ||
[ | ||
{ | ||
"TaskName": "MyTaskName1", | ||
"Action": [ | ||
{ | ||
"Argument": "-NonInteractive -NoProfile -NoLogo -Command \"New-Item \\\"$env:TEMP\\$(Get-Date -UFormat .%s-1-1)\\\"\"", | ||
"Execute": "powershell" | ||
}, | ||
{ | ||
"Argument": "-NonInteractive -NoProfile -NoLogo -Command \"New-Item \\\"$env:TEMP\\$(Get-Date -UFormat .%s-1-2)\\\"\"", | ||
"Execute": "powershell" | ||
} | ||
], | ||
"TaskPath": "\\MyTaskFolder\\", | ||
"Trigger": [ | ||
{ | ||
"AtStartup": true | ||
}, | ||
{ | ||
"DaysInterval": 1, | ||
"Daily": true, | ||
"At": { | ||
"Day": 30, | ||
"Second": 0, | ||
"Year": 1999, | ||
"Hour": 17, | ||
"Minute": 30, | ||
"Second": 0, | ||
"Day": 30, | ||
"Hour": 17, | ||
"Month": 11 | ||
}, | ||
"Daily": true, | ||
"DaysInterval": 1 | ||
} | ||
} | ||
], | ||
"Action": [ | ||
{ | ||
"Execute": "powershell", | ||
"Argument": "-NonInteractive -NoProfile -NoLogo -Command \"New-Item \\\"$env:TEMP\\$(Get-Date -UFormat .%s-1-1)\\\"\"" | ||
}, | ||
{ | ||
"Execute": "powershell", | ||
"Argument": "-NonInteractive -NoProfile -NoLogo -Command \"New-Item \\\"$env:TEMP\\$(Get-Date -UFormat .%s-1-2)\\\"\"" | ||
} | ||
], | ||
"Settings": { | ||
"DontStopIfGoingOnBatteries": true, | ||
"Disable": false, | ||
"AllowStartIfOnBatteries": true | ||
}, | ||
"Principal": { | ||
"UserId": "myusername", | ||
"LogonType": "S4U", | ||
"UserId": "myusername", | ||
"RunLevel": "Highest" | ||
}, | ||
"TaskPath": "\\MyTaskFolder\\" | ||
"Settings": { | ||
"Disable": false, | ||
"DontStopIfGoingOnBatteries": true, | ||
"AllowStartIfOnBatteries": true | ||
} | ||
}, | ||
{ | ||
"TaskName": "MyTaskName2", | ||
"Action": [ | ||
{ | ||
"Argument": "-NonInteractive -NoProfile -NoLogo -Command \"New-Item \\\"$env:TEMP\\$(Get-Date -UFormat .%s-2-1)\\\"\"", | ||
"Execute": "powershell" | ||
}, | ||
{ | ||
"Argument": "-NonInteractive -NoProfile -NoLogo -Command \"New-Item \\\"$env:TEMP\\$(Get-Date -UFormat .%s-2-2)\\\"\"", | ||
"Execute": "powershell" | ||
} | ||
], | ||
"TaskPath": "\\MyTaskFolder\\", | ||
"Trigger": [ | ||
{ | ||
"Once": true, | ||
"At": { | ||
"Day": 30, | ||
"Second": 0, | ||
"Year": 1999, | ||
"Hour": 14, | ||
"Minute": 0, | ||
"Second": 0, | ||
"Day": 30, | ||
"Hour": 14, | ||
"Month": 11 | ||
}, | ||
"Once": true, | ||
"RepetitionInterval": { | ||
"Minute": 0, | ||
"Second": 0, | ||
"Hour": 12, | ||
"Second": 0 | ||
"Minute": 0 | ||
} | ||
} | ||
], | ||
"Settings": { | ||
"DontStopIfGoingOnBatteries": true, | ||
"Disable": false, | ||
"AllowStartIfOnBatteries": true | ||
}, | ||
"Action": [ | ||
{ | ||
"Execute": "powershell", | ||
"Argument": "-NonInteractive -NoProfile -NoLogo -Command \"New-Item \\\"$env:TEMP\\$(Get-Date -UFormat .%s-2-1)\\\"\"" | ||
}, | ||
{ | ||
"Execute": "powershell", | ||
"Argument": "-NonInteractive -NoProfile -NoLogo -Command \"New-Item \\\"$env:TEMP\\$(Get-Date -UFormat .%s-2-2)\\\"\"" | ||
} | ||
], | ||
"Principal": { | ||
"UserId": "NT AUTHORITY\\SYSTEM", | ||
"LogonType": "S4U", | ||
"UserId": "NT AUTHORITY\\SYSTEM", | ||
"RunLevel": "Limited" | ||
}, | ||
"TaskPath": "\\MyTaskFolder\\" | ||
"Settings": { | ||
"Disable": false, | ||
"DontStopIfGoingOnBatteries": true, | ||
"AllowStartIfOnBatteries": true | ||
} | ||
}, | ||
{ | ||
"TaskName": "MyTaskName3", | ||
"Action": [ | ||
{ | ||
"Argument": "-NonInteractive -NoProfile -NoLogo -Command \"New-Item \\\"$env:TEMP\\$(Get-Date -UFormat .%s-3-1)\\\"\"", | ||
"Execute": "powershell" | ||
}, | ||
{ | ||
"Argument": "-NonInteractive -NoProfile -NoLogo -Command \"New-Item \\\"$env:TEMP\\$(Get-Date -UFormat .%s-3-2)\\\"\"", | ||
"Execute": "powershell" | ||
}, | ||
{ | ||
"Argument": "-NonInteractive -NoProfile -NoLogo -Command \"New-Item \\\"$env:TEMP\\$(Get-Date -UFormat .%s-3-3)\\\"\"", | ||
"Execute": "powershell" | ||
} | ||
], | ||
"TaskPath": "\\MyTaskFolder\\", | ||
"Trigger": [ | ||
{ | ||
"DaysInterval": 1, | ||
"Daily": true, | ||
"At": { | ||
"Day": 30, | ||
"Second": 0, | ||
"Year": 1999, | ||
"Hour": 10, | ||
"Minute": 0, | ||
"Second": 0, | ||
"Day": 30, | ||
"Hour": 10, | ||
"Month": 11 | ||
}, | ||
"Daily": true, | ||
"DaysInterval": 1 | ||
} | ||
}, | ||
{ | ||
"DaysInterval": 1, | ||
"Daily": true, | ||
"At": { | ||
"Day": 30, | ||
"Second": 0, | ||
"Year": 1999, | ||
"Hour": 14, | ||
"Minute": 0, | ||
"Second": 0, | ||
"Day": 30, | ||
"Hour": 14, | ||
"Month": 11 | ||
}, | ||
"Daily": true, | ||
"DaysInterval": 1 | ||
} | ||
}, | ||
{ | ||
"DaysInterval": 1, | ||
"Daily": true, | ||
"At": { | ||
"Day": 30, | ||
"Second": 0, | ||
"Year": 1999, | ||
"Hour": 18, | ||
"Minute": 0, | ||
"Second": 0, | ||
"Day": 30, | ||
"Hour": 18, | ||
"Month": 11 | ||
}, | ||
"Daily": true, | ||
"DaysInterval": 1 | ||
} | ||
}, | ||
{ | ||
"DaysInterval": 1, | ||
"Daily": true, | ||
"At": { | ||
"Day": 30, | ||
"Second": 0, | ||
"Year": 1999, | ||
"Hour": 22, | ||
"Minute": 0, | ||
"Second": 0, | ||
"Day": 30, | ||
"Hour": 22, | ||
"Month": 11 | ||
}, | ||
"Daily": true, | ||
"DaysInterval": 1 | ||
} | ||
} | ||
], | ||
"Action": [ | ||
{ | ||
"Execute": "powershell", | ||
"Argument": "-NonInteractive -NoProfile -NoLogo -Command \"New-Item \\\"$env:TEMP\\$(Get-Date -UFormat .%s-3-1)\\\"\"" | ||
}, | ||
{ | ||
"Execute": "powershell", | ||
"Argument": "-NonInteractive -NoProfile -NoLogo -Command \"New-Item \\\"$env:TEMP\\$(Get-Date -UFormat .%s-3-2)\\\"\"" | ||
}, | ||
{ | ||
"Execute": "powershell", | ||
"Argument": "-NonInteractive -NoProfile -NoLogo -Command \"New-Item \\\"$env:TEMP\\$(Get-Date -UFormat .%s-3-3)\\\"\"" | ||
} | ||
], | ||
"Settings": { | ||
"DontStopIfGoingOnBatteries": true, | ||
"Disable": false, | ||
"AllowStartIfOnBatteries": true | ||
}, | ||
"Principal": { | ||
"UserId": "myusername", | ||
"LogonType": "S4U", | ||
"UserId": "myusername", | ||
"RunLevel": "Highest" | ||
}, | ||
"TaskPath": "\\MyTaskFolder\\" | ||
"Settings": { | ||
"Disable": false, | ||
"DontStopIfGoingOnBatteries": true, | ||
"AllowStartIfOnBatteries": true | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.