Does running as a task sequence always disable Interactive mode?

Pretty new to the Toolkit. I built a script to uninstall old versions of Microsoft Office and then install Office 365. It works great when I deploy as an application in SCCM 2012. Users get prompted to close any open Office applications before the install continues, so no one loses any work in progress.

However, when I make it part of a task sequence, there are no prompts and applications simply close without prompting to save, so users lose their work in progress.

I’m running the installation as “Deploy-Application.exe” -DeployMode “Interactive”. The application is set to install whether or not a user is logged on. I’ve also tried commenting out parts of AppDeployToolkitMain.ps1 that appear to detect whether the program is running as part of a task sequence.

No luck so far. Based on the documentation that comes with the toolkit, my understanding is that if I’m running an application as part of a task sequence, any dialogs I’ve written into my PowerShell script will be disabled.

Is that a correct understanding, or is there a way to still let users see intended messages?

Thank you.

That is correct. Why would your users work with the computer while a task sequence is running? I guess TS’s could be implemented in many different ways, but I would only use them for OS Deployment and perhaps reconfiguration of bios/uefi settings.

Maybe you have a very specific reason for letting the users work while a TS is running but… If utilized correctly the Application model will give you the same results as a application bundle TS, only more dynamic, and with better tracking, so if that’s what you’re doing I’d advice you to start transforming those to the application model instead :)…

Thanks for the info, Pelle. I’m not so much concerned about what users are doing during the task sequence, but rather, immediately prior.

The task sequence I have installs Office 365 and the latest version of our anti-virus. I know I can also do separate deploys for each of these applications (using SCCM 2012), but I thought a task sequence offered some benefits that separate deploys didn’t.

And so here’s why I brought up the question in the first place: let’s say there’s a user, and that user is composing an email, working on a spreadsheet, and creating some documentation in Word. And let’s say that as an SCCM administrator, I’ve created an Office 365 application in SCCM 2012, and that I’ve used the PoSH App Deploy Toolkit.

When the mandatory deploy time arrives, because of how I’ve coded the PowerShell script, the user sees a nice dialog saying, “Hey, you’ve got these applications open, but they need to close so I can perform this install. Save your work and close them, or click the other button to just continue on if you don’t care about saving your work”. User saves his/her work and performs the install. All is well.

Using a task sequence, though, the user never sees that dialog, and all their processes are killed. Install runs. but now we have an angry user who’s lost a fair amount of work-in-progress.

I reckon a workaround would be to write a program that does the detection of open apps and alerts the user, and create that outside of the PoSH Toolkit, then include it in the task sequence. However, it would be nice for the PoSH Toolkit to at least have the option to turn on/off user notifications while running a task sequence.

At any rate, your answer helps clears up the mystery for me, so thank you!
Using the Application model in SCCM, running my PowerShell App Deploy Toolkit (triggering Deploy-Application.exe), I as the user

I’ve done this in the following way:

  1. Create a package in SCCM without any program. Make sure you add “serviceui.exe” to the package.

  2. Create a “Run Command Line” as 1st step in ts
    Command line:
    ServiceUI.exe -process:TSProgressUI.exe %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File Deploy-Application.ps1

Options:
Condition - Run if conditions are met --> WMI Query
SELECT * FROM Win32_ComputerSystem WHERE UserName != NULL

  1. I’ve also modified the “Deploy-Application.ps1” script with
    $AnyLoggedOnUsers=Get-LoggedOnUser -ErrorAction SilentlyContinue
    if ($AnyLoggedOnUsers.Count -gt 0)
    {
    $TSProgressUI = New-Object -COMObject Microsoft.SMS.TSProgressUI
    $TSProgressUI.CloseProgressDialog()
    Show-InstallationWelcome -CloseApps “iexplore” -BlockExecution -PromptToSave -PersistPrompt -AllowDefer -DeferTimes 3 -CustomText $true
    }

If “no user is logged on” it will NOT run the PADT-script and just continue on with next step in the task sequence.
If “a user is logged on” it will run the PADT-script and not continue with next steps until user continues the install.

If the user defers, ts will fail and run on next schedule for the deployment of the ts.
I’ve set the ts to rerun “Every day” if failed previous attempt

BTW: the WMI query doesn’t work for users logged on to machine via RDP, must be logged on to console.

Hi,

On an application deployment, how your script would react if only the system account would be there? So the user count would be always at least one?!

Thanks,

François

It works just fine, I only get dialog boxes whenever an ordinary user account is logged on.

Hi,

I have similar problems with alerting my user, after an application deployment, if a reboot is need.

IMHO, the variable would be better $CurrentConsoleUserSession. If you get a look in the file E:\Temp\Test1.0_Frv1\Test1.0_Frv1.ps1 (version 3.6.8) on line 10349, the code illustrate what to do if someone is logged on.

I did tried “if ($AnyLoggedOnUsers.Count -gt 0)” but it is not an array so I got an error.

Thanks,