Run a command AFTER the end of a task sequence?

Andrew J Buehler 1 Reputation point
2022-10-06T00:10:16.18+00:00

How can I arrange to run a command after the end of a task sequence? Not as the very last action taken in the task sequence, and not via SMSTSPostAction (which is still run while the task sequence is active, as shown by the fact that the exit code from running that command is logged in smsts.log); after the task sequence has completed and been cleaned up.

My best guess at this point involves finding a way to run a PowerShell script and have the task sequence engine not wait for it to complete, but just keep going and finish the TS and clean up the remains of executing the TS - and the TS can sleep-loop checking whether C:\_SMSTaskSequence or C:\Windows\System32\_SMSOSDSetup or the like still exists, and once it doesn't, run the necessary command. But I haven't managed to find a way to do that (initiate a command and have the TS not wait for it), either, so that's not a useful lead.

What I'm trying to do here is to initiate the autologon, auto-start, et cetera, procedure of the "SiteKiosk" kiosk software (https://www.sitekiosk.com/). There's a program (installed with the software) which can be run to do that, and that's straightforward enough. The autostart configuration involves not only defining autologon settings, but also replacing the explorer.exe shell with a different program, temporarily disabling the keyboard during boot (I think through use of a custom driver), and possibly a few other things in addition.

When a task sequence which installs the software and runs the set-up-autostart program and reboots the computer is invoked from Software Center, everything works fine; the software installs, the computer restarts, and the software's autologon mode comes up active, just as intended.

But when the same task sequence is invoked as the last step at the end of an OSD task sequence, things go bad. After the software installs and the computer restarts, Windows ends up at a "something went wrong" screen that talks about some kind of Windows update and prompts you to click a "Next" button; doing so makes Windows go through a repair process, which drops you at the normal Windows logon screen (instead of logging in automatically), with Windows not responding to the keyboard.

It seems clear to me that either the set-up-autostart configuration is stomping over some settings which the OSD TS environment relies on, or the cleanup process which happens at the end of the OSD TS is overwriting some of the settings which were put in place but the set-up-autostart program.

I therefore need some way to move that "run this EXE with these arguments, then reboot" process to a point where it will be run after the OSD TS has finished and been cleaned up, so that the circumstances for the conflict to arise will no longer be present - but with as little delay after that point as practical, so that the kiosk can be available as soon as possible (and people don't try to do other things with it in the meantime). Doing that requires setting up a command to run after the end of the TS, as per my original question above.

But I have been bashing my head against this wall for weeks on end, with no success, and before I start literally tearing my hair out I want to ask for help.

Microsoft Configuration Manager Application
Microsoft Configuration Manager Application
Microsoft Configuration Manager: An integrated solution for for managing large groups of personal computers and servers.Application: A computer program designed to carry out a specific task other than one relating to the operation of the computer itself, typically to be used by end users.
461 questions
{count} votes