I need to force the TASK scheduler to run with VERSION -2 in the argument - It disappears after few runs
I have a script 1 which creates a task - Task runs the script 2 - 1 and 2 are PS1
Script 1 creates the task which runs Script 2
I need to add an argument to the task via the script 1 -Version 2 which works for few runs and then disappears.
Please log in to answer
Posted by: JasonEgg 4 years ago
I would suggest making "script 1 version 2" set/change a registry entry to indicate how many times the script has ran on the computer. I admit this would be impractical if the job needs to run ten times, but would be fairly straightforward if the script only has to run three times or less. There is no option to say "increment reg value" so you'd have to use "verify a registry value is" with remediation/success logic to set the correct number.