Task sequences in sccm provide a great mechanism for executing several steps, for example during complex application or operating system deployment.
One of the features, by design, is that task sequences allways run without interaction of the end-user, logic in most circumstances.
In order to show what we mean we have created a simple ts, running notepad.exe
If we run the ts this is what we see :
The TS is running but the user does not see the process notepad.exe
The notepad is running but the user can’t see it , it’s running in the system context without user interaction.
Now we create another ts using serviceui.exe, this executable is part of the MDT2010 installation. Just create a package with the executable.
Remember that you have a X86 and X64 edition and if you want to test, the process needs to be executed under system credentials ( so use psexec -s cmd.exe )
The interactive ts looks like this.
Run a custom command line :
serviceui.exe -process:TSProgressUI.exe %windir%\notepad.exe
Now if we run this task sequence :
Oh … great ! Now you can run your favorite powershell wrappers interactively in a task sequence.
serviceui.exe -process:TsProgressUI.exe %windir%\System32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy Bypass -file .\MyFavoriteWrapper.ps1
Update ! There is a problem with running the serviceui.exe if there is no active user logged on. The executable returned an error in our environment at this moment. In order to workaround this issue you can use a WMI query as a condition for the serviceUI.exe task.
select * from win32_computersystem where username IS NOT NULL
Use this so the serviceui task will only run if there is a logged on user. If not the task will be skipped and the rest of the ts will run.