Skip to content

Job_ActivateUserSetup

Registers a user script from a computer job so that it runs in each user’s own context when the user logs on. Call it from a computer (WS) job.

The function uses Windows Active Setup:

  • It copies the user script from the package’s Scripts folder to <CapaInstaller client directory>\Usersetup\<product ID>\<package version>\ on the computer.
  • It registers the script under HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\<sGUID>.
  • At logon, Windows runs the script once for every user who hasn’t run this version yet. This includes users who already have a profile on the computer.
  • If the CapaInstaller InfoCenter is running, the script also starts right away for the user who is logged on.

When you create a package with a user script in the CapaInstaller Package Creator, the Package Creator adds this call and generates sGUID for you.

To remove the registration again, for example when you uninstall the package, call Job_RemoveUserSetup with the same GUID.

Job_ActivateUserSetup(sJobName, sVersion, sGUID) As Boolean

File name of the user script in the package’s Scripts folder, for example <Job Name>_us.cis.

Version of the user script. A leading letter and any dots are removed before the version is written to Active Setup, so v1.0 becomes 10. Increase the version to make the script run again for users who have already run it.

A GUID that identifies the Active Setup entry, including the braces. Use a new GUID for each package.

If bStatus Then bStatus = Job_ActivateUserSetup("<Job Name>_us.cis", "v1.0", "{<Insert Random Guid Here>}")

Scripting Guidelines

Job_RemoveUserSetup Constants Package Property Variables