Per User Login Message

Per User Login Message

Challenge

A common challenge with Windows 10 Upgrade task sequences is handling user logins if there are any restarts during the task sequence. After the restart happens, a user can log back into the system but has no way of knowing that a background process (the upgrade task sequence) is running. Additionally, after the user logs in, the task sequence progress bar may take a while to be shown again (or may never reappear). This isn’t initially a problem but will quickly become an issue when the task sequence restarts the system again and gives the user little to no warning. Think of calls for iron maidens and execution by the users for the perpetrator of such an injustice; i.e., you.

Restart?

So this first begs the question of why you would have a restart in an upgrade task sequence in the first place. There are many valid reasons, and all of them are indicative of why most folks choose to use a task sequence to roll out their feature updates instead of servicing. Here are a couple that I’ve seen and used:

  • Software uninstallation that requires a reboot; e.g., third-party anti-virus.
  • Dropping to WinPE to switch the install language.

Addressing the Challenge

There is no graceful solution here. Gary Blok presents one possible approach to addressing the challenge in his blog post Change Lock Screen & lockout users during Upgrade TS. There are potential problems with this approach though like GPOs overwriting these settings. Not being able to directly log into a system if you need to troubleshoot issues if (or when) they happen is another shortcoming. I’m not discounting Gary’s solution at all, just providing an alternative (or possibly a supplemental approach) if his approach won’t work in your environment.

My approach at a recent customer for this challenge — because they had GPOs in-place that would prevent Gary’s method — is to display a message to the user when they log in while the TS is still executing. To do this, we first need to create a pop-up message of some sort. Luckily, UI++ is perfect for this. To have UI++ pop-up and show the user a warning message, we need to first copy the necessary files locally, and then add the appropriate command-line as a value to the Run key for every existing user as well as the default user (in case a new user logs in).

UI++

Here’s a basic “warning” message for the end user. This, of course, is completely customizable.

Windows 10 Upgrade in Progress Warning using UI++

Windows 10 Upgrade in Progress Warning

UpgradeInProgess.xml

Copying the Necessary Files

For this simple task, I used a previously posted script of mine from Copying Files to Clients Using ConfigMgr with one additional command added at the end to call the next script which adds the Run registry value to every user’s profile. Here’s the slightly modified version:

configure.bat

Configuring the Run Value

This script is a follow-up to my post on Copying Files to Every User’s Profile; instead of copying a file to every user’s profile though, it sets or adds a registry value in every user’s profile. In this case, it adds a value to the Run key so that the message above is shown every time that a user logs in. This script deserves a post of its own, but for now, here it is.

UserProfileReg.bat

Removing the Run Value

Once the task sequence is finished (or almost finished) we need to stop the notice from being displayed at login. For this, a slightly modified version of the above UserProfileReg.bat file will do the trick.

RemoveUserProfileReg.bat

Putting it All Together

  1. Create a folder in your source repository; e.g., Win10UpgradeNotice. This will be the source location specified for a new package.
  2. Copy configure.bat to the Win10UpgradeNotice folder.
  3. Create a subfolder in Win10UpgradeNotice called Content.
  4. Copy UpgradeInProgess.xml, UserProfileReg.bat, RemoveUserProfileReg.bat, and UI++.exe to the Content subfolder. (UI++ is available from the UI++ page.)
  5. Create a package specifying the UNC for the Win10UpgradeNotice folder in your source repository.
  6. Create a run command-line task in the task sequence (near the beginning after any initial pre-flight checks).
    • Reference the package created in step 5.
    • Specify the following Run command-line:
    • configure.bat c:\Windows\Temp\Win10Upgrade
  7. Create a run command-line task in the task sequence (near or at the end).
    • No package needed.
    • Specify the following Run command-line:
    • c:\Windows\Temp\Win10Upgrade\RemoveUserProfileReg.bat

Process summary

Step 6 above configures the heart of this process. Here’s a brief description of what happens when configure.bat runs in this step.

  1. It copies the files from the Content subfolder to a new subfolder of C:\Windows\Temp called Win10Upgrade (you can, of course, change this if you wish by modifying the command-lines in steps 8 and 7 above).
  2. It then calls UserProfileReg.bat to register the UI++ the command line in the registry of every user to display the message whenever a user logs in. This command-line is embedded in the UserProfileReg.bat:
  3. cmd.exe /c start /D %DEST% UI++64.exe /config:UpgradeInProgress.xml

A few notes on this command-line

  • cmd.exe is used because start is a command-shell command. The /c switch tells cmd.exe to run the command specified after it and then exit.
  • start is used to specify a working directory (using the /D switch) so that relative paths can be used to specify the configuration XML file and within the configuration XML file.
  • %DEST% is passed to UserProfileReg.bat by configure.bat and is the path specified on the command-line in step 6 above. If you wish to change this path, simply change it in steps 6 and 7 above.

Summary

As noted previously, there are no perfect solutions to the problem presented, but this one met the needs of my previous customer. The above can also be adapted for other scenarios and the scripts used for other purposes.

Task Sequence One-liners

Next Article

Task Sequence One-liners

4 Comments

Cancel

  1. Great post and i like it. My only concern would be if for whatever reason the Task Sequence does not restart or the WaaS upgrade fails during the reboot/upgrade, there is then nothing that is going to remove the user prompt. I’d be inclined to somehow put a time limit on this whereby the prompt will only be displayed if it is inside 2 hrs of when it was configured that way in the registry.

    • Yes, totally valid. I thought of this but never gave it a lot of thought. I’ll ponder it some more to see if there’s an easy way to add some type of time limit as that’s a good suggestion for how to handle it.

  2. Love your site Jason! Keep up the great work.
    I can’t seem to download the files to test. Is there another link I can download?

    • Hi MX. WHich files exactly are you referring to? This page only has embedded snippets with no direct file downloads on it.