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.


0 Comments   [ + ] Show comments

Answers (1)

Posted by: JasonEgg 4 years ago
Red Belt
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.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ