Update: New "Lite" Versions - On GitHub which checks execution history.
Goal: Trigger Task Sequence remotely via Run Script. Allows you to trigger on one computer or several. *The Policy for the Task Sequence most already be on this machine.
Type the Package ID for the Task Sequence you want to trigger on the machines:
You can Hover over for more info:
The Return information is LIMITED to a couple scenarios I check for.
- Check for Task Sequence on Machine with Package ID
- Trigger Task Sequence
- Wait 2 Minutes
- Check ExecMgr Log for:
- Successful launch of TS with Package ID
- Waiting for MW
- If neither of those options are found in the log, it Reports "Failure"**
- This can be a false positive... Example... If you have the TS set to download content before starting, it could still be downloading the required content after you triggered it... so eventually the TS might still kick off after the content has downloaded.
For more details you'll need to dig through the execmgr and other logs.
Now... the script:
Let me know if you use it and how it goes... GARYTOWN.COM
PS... special shout out to Jeff Scripter for the Function I use to parse the execmgr log.
10 thoughts on “Run Scripts: Trigger Task Sequence”
I loaded your script into VSCode and it detected "99 problems in this file". When attempting to run it, it generates so many error that is states "Not all errors were reported. Correct the reported errors and try again."
I use ISE. 🙂
Find: & l t ;
Replace with : <
Thanks for this, Gary. One thing I'm curious about... what's the significance of CAS29CDE-CAS04823-6F6BCC28 in the xml string? Before your script changes it, it matches $TSScheduleMessageID. I thought it was a mistake, so I tried tweaking your script to leave it as the actual message ID, but the TS always fails to trigger. So, I admitted that you obviously knew what you were doing and put it back the way you had it, which then worked fine. But now I have to know... where did you get that value and what's so special about it?
You know what, I didn't even realize that was there. Technically there is nothing special about it.
If I had time, I'd look into it, probably can remove that line completely, but I'd have to dig in.
I used Client Center to get the basics to the code that triggers the TS, then added params and other code to make it into a Run Script and provide feedback.
Client Center: https://github.com/rzander/sccmclictr
Dude, 90% of this code is not necessary and makes it more difficult for others to modify or debug. Can you trim it down to the essentials?
Thanks for sharing Gary. This is exactly what I was looking for today!
I have 18 items in a collection, how can I run it on only a single machine?
You can run a script on individual computers by right clicking on a specific computer, then run script