Scripting Question

Getting and using variables in MSI for SCCM

09/05/2013 5208 views

Hi All,

first up, I  hope this is going to the right forum, and second, this is only the second posting I have had a need to do to ask a question (on another site)

I am quite new to MSI packaging and MST creation and need to see if there is a way to get the username from the registry and deploy files to the c:\users\{username}\{location}.  Currently I am using a VBScript that runs my installer and the rest of the script pulls the username from HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\LastLoggedOnUser, then copies the files to c:\users\{LastLoggedOnUser}\....

The reason why I have to do it this way, is we are using SCCM 2012 deploying Applications (not Packages) as Device.  The problem with doing this, it is installing under system space, and here there is no user.  SET does not give a user, WhoAmI gives a system name.  There is only 2 locations where I have found a username, the location above and \LastLoggedOnUser\SessionData\1 or 2 or... this number is variable depending on the number of logged in users.

Ok so when deploying to Device and you add a reg entry to HKCU in your MSI or MST, these entries get placed in to the system user, and won't run when SCCM has done its bit of installation.

Our system/policies do not allow Active Setup to work, if it works for HKLM? and the other solution was to have the user do a reboot and place a MSIEXEC /FP {GUID} in HKLM\....\RUN.

The files I am tring to deploy could be any form of user files, preferences etc... I just finished Quicktime with the VBScript that copied the two pref files in their locations, first in Default user (so any new user to the computer gets the files) and the script then copies them to the user locations.

I was looking at System Search in Wise and also running my VBScript in Execute Deferred, but neither so far have worked.

I would like the MSI to do as much as possible without calling the MSI from a VBScript.

Any guidance from anybody would be appreciated and I hope I made sense in my description.


4 Comments   [ + ] Show comments


  • Google for 'John McFadyen self healing'.

    For packages with no advertised entry-point (such as an advertised shortcut), use Active Setup.

    Once you've read on those topics, come back with anything you need clearing up.
  • I have had one of John's ex-students help me out with active setup, and we could not get it to work. Finding the googles said on one forum I found, UAC could be the cause of Active Setup not working. I have found a txt document, one of John's old doco's, and I will follow that today.
    Also, I have found, adding HKCU stuff under its own feature made the user stuff to install elsewhere and I can't remember where it went now, it was 2 months ago the last time I tried that. When I did do the AS stuff, I only used msiexec /fp and did not use the u, so while I am at it today, I will /fup it.
    Thanks guys
    will let you all know what happens by days end.
  • Hi VBScab
    I have been to http://installpac.wordpress.com/2008/03/30/windows-installer-self-healing/ and followed the link at the bottom to my it forum, and I am following the section at the bottom starting with "Create a new FEATURE STRUCTURE as follows:" I don't understand how I can get files into the CU. I keep getting ICE38 and 91 on those files and unable to drop them and their directories up to CurrentUser Feature. These files do not install on a second user login but the MSI seems to perform a self heal on every run for this user.
    I have to move on with a different project for today, but I might be able to get physical help next week.
    I'll keep everyone informed.
  • ICE38 means that you either have a file set as keypath for a user-level component or, most likely - since most validation programs are, in general, too stupid to check - no keypath set.

    ICE91s can be ignored in these cases because we're forcing self-healing.

    >unable to drop them and their directories up to CurrentUser Feature
    Wise was quite happy to let you drag components around the UI but InstallShield can be recalcitrant in this regard. Ho hum... To re-arrange the components in IS, you'll need to edit the FeatureComponent table using the Direct Editor.

Community Chosen Answer


We've had the same issues with ActiveSetup not working in our environment. What we do, is when a script installs ActiveSetup keys, we execute the following command so that it will complete when user logs in..

C:\windows\system32\reg.exe DELETE "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components" /v "NoIE4StubProcessing" /f

Answered 09/06/2013 by: ekgcorp
10th Degree Black Belt

All Answers


Sounds like you need Active Setup to pull this off... http://www.itninja.com/blog/view/appdeploy-articles-activesetup

basically it puts keys in HKLM, then when user logs in, it compares what is in (their) HKCU to HKLM, and will run whatever command, MSI, or exe you have declared in HKLM but as them. So anything that needs to get to each HKCU will happen when they login the first time.

Answered 09/05/2013 by: ekgcorp
10th Degree Black Belt

  • You only need ActiveSetup if you don't have advertised shortcuts that will place these user files for you on first run of the application, as it will repair these when they are found to be missing for the current user.

    I'm intrigued why ActiveSetup is not allowed by system policies though......
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ