Network folders, Profiles & Active Setup
Sometimes, files need to be copied to a users’ Home Drive when they use and application. You must not hard code an MSI to expect network drives and you have problems expecting a particular drive mapping to be present when an MSI is installed. Mostly, software distribution systems don’t need Home Drive mappings so trying to get a logical solution to this problem requires some inventiveness.
Using Custom Actions with Active Setup is one way to get around all of the profile related tasks you may wish to perform.
Once the Application is installed we force a “Repair” to run whenever a new user logs onto their machine. In the example above, MSIEXEC is run with a repair option (/fu) followed by the Product Code of the Application installed.
Note: This method was very much in fashion in the mid 2000's (when this was written) and often involved reordering features to reduce the time a repair would take to run. Instead of calling a repair (as shown) it's probably better to call a script or Autoit Executable directly!
Active Setup routines are simply created by inserting keys under “HKLM\Microsoft\Active Setup\Installed Components\[UNIQUE IDENTIFIER]\”
- StubPath is the command that will be run (Once for each user)
- Version is separated by commas… not dots as you might expect
- The “Default” value gives the friendly name of what’s being installed when the user logs on.
At logon, Windows checks all of the Unique “HKLM\Microsoft\Active Setup\Installed Components” entries within against the HKCU entries and if a new one exists, it runs the command with it’s associated Stubpath and records the Unique entry under HKCU. The HKCU entry is written regardless of the success of the embedded STUBPath executable.
In this scenario, the Condition of “Installed and (NOT REMOVE)”
------------------------------VBScript to copy a file
' Create the File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
If (objFSO.FolderExists("P:\Application Data"))= False Then
objFSO.CreateFolder ("P:\Application Data")
If (objFSO.FolderExists("P:\Application Data\Ecco"))= False Then
objFSO.CreateFolder ("P:\Application Data\Ecco")
objFSO.CopyFile "c:\Program Files\EccoWare\Docs\Test.tww", "P:\Application Data\Ecco\Test.tww"