Actions

Active User Setup

From Syntaro Help

Why you need this

We all know, that sometimes applications need user settings in the Current User Registry or File Changes in the User Profile. Therefore, two main Technologies could be used:

  • MSI Repair / Advertised Shortcuts
  • Active Setup

Most of the Package Engineers we know use Active Setup, when the package was not MSI based or some special things had to be executed.
The solution was really cool and helped a lot. This functionality is also built-in in famous package wrapping utilities like the PSAppDeployToolkit.

Now the main Issue is, that Active Setup entries are not migrated during an Inplace Upgrade of Windows 10.

This led to one question, why is it not migrated? And we found an answer which we never Imagined:
Active Setup is not a public available functionality and is not supported for use by other components than the operating system.
This was already written in 2011, but was not that important, because inplace updates where not required that often.

This is why we created Active User Setup, an alternative that will still work after a Inplace Upgrade.

The solution has the following features:

  • Logging of actions to %TEMP%\ActiveUserSetup.log
  • Executing things once for every user after login
  • Versioning of the actions, so if you change something, then the action will be executed again for every user
  • Success Exit Code definition, to have a retry if the action failed on the last login.
  • Wait on Exit of the process (Synchronous or Async Mode)

Active User Setup Documentation

First you need to install the ActiceUserSetup MSI on your Computers.

If you want to execute something once in the User Context, when the user is login on, then you have to create a Key under: HKEY_LOCAL_MACHINE\SOFTWARE\ActiveUserSetup

The Name of that key needs to be unique. So, a good way to guarantee that would be to use a GUID.

You can then create the following entries below it, depending on your needs:

Item Type Optional/Must Description
Execute REG_SZ Must The Command that gets executed. If the Command needs Arguments provide them in the dedicated Argument Item.
Argument REG_SZ Optional The Arguments for your Exe
Name REG_SZ Optional A Name that explains what this task is about. If you use a GUID as the Key name this helps you understand what that Task does.
Version REG_SZ Optional The Version will be written to the user Registry and when you change it here the task will get executed once more.
SuccessfulReturnCodes REG_SZ Optional* A list separated by “;” that indicates that your task run successful.
WaitOnFinish REG_DWORD Optional* Set it to 1 if you want the Tool to wait for that Task to finish.
OnlyWhenSuccessful REG_DWORD Optional Set it to 1 if you want the User Registry Part only to be written when the Exit Code was one from your List.

The Items with a * are a must when you use “OnlyWhenSuccessful”


The Tool then runs as a Scheduled Task on every user Logon.

It logs to %TEMP%\ActiveUserSetup.log

Examples

Here is an Example of the Registry:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\ActiveUserSetup\Demo_Key_All_Commands]
"Execute"="C:\\WINDOWS\\system32\\msiexec.exe"
"Argument"="/fu {BA95F312-9799-4BAE-ABAF-974ED79DD979} /qb-!"
"Name"="Test Key"
"Version"="1"
"SuccessfulReturnCodes"="0;3010"
"WaitOnFinish"=dword:00000001
"OnlyWhenSuccessful"=dword:00000001

Template

Here you finde the content of a Regfile that you can use as a Template and customize as needed.
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\ActiveUserSetup]

[HKEY_LOCAL_MACHINE\SOFTWARE\ActiveUserSetup\%AUniqueName%]
"Execute"="%TheFileYouWantToExecute%"
"SuccessfulReturnCodes"="0;3010;%OrWathEverYouNeed%"
"WaitOnFinish"=dword:00000001
"OnlyWhenSuccessful"=dword:00000001
"Name"="%TheUserfrendlyNameOfTheTask"
"Version"="%AnyValue%"
"Argument"="%ArgumentsForYourExecutable%"