I know per user files/registry settings are not possible under System Context but I'm trying to deploy a simple drop and run package controlled through vbscripting. In an msi package, this is very simple by doing an active setup. What are the possible solutions that I can try?

My main vbscript will call for the installer and then after install, an hkcu settings should be imported. I already tried using reg.exe import with no success. Don't know if run once is applicable when executed in standard user account. This is going to be deployed using SCCM (though the deployment server aint setup yet so i dont know how the testing will be). Thanks!

0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Community Chosen Answer

3

There are numerous ways to do this, but activesetup is probably the easiest.  You don't need MSI to do activesetup, but msi can be used to set it up.

Here is a good basic article on setting up active seutp: http://www.itninja.com/blog/view/appdeploy-articles-activesetup

Though they use msi commands, you can use any command you wish (both in stubpath and in setting up activesetup to hklm), you probably will have issues with limited accounts unless you use repair with msi though.  Again IF you have limited accounts to worry about.

Run once can be used but you need to install it on each profile already on the computer, and also the default profile for new accounts that login.  IF multi-user support is required.  I personally use msi self-heal, or active setup before this, too complicated and too much work.

It sounds like this isn't an app which is launched via shortcut (aka it auto-runs or is passive).  But if not, you can also use advertised shortcuts (msi installer) and self-heal to add per user keys.

 

Answered 10/29/2012 by: dandirk
Third Degree Green Belt

  • yea, simple, Active setup, followed by a nice restart. job done..
Please log in to comment

Answers

1

Use the following WMI scripting for WIN 7 OS to set HKCU registry of a logged on user while installing under a software deployment service account. Maybe some stripping of the data entry is required (e.g. domain) to get the right user account. 

' Retrieving last logged on user account from HKLM 64/32 bits registry.
Const HKEY_LOCAL_MACHINE = &H80000002
profilename = ReadRegStr (HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI", "LastLoggedonSAMUser", 64)

' Converting last logged on user account to SID.
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objAccount = objWMIService.Get _
   ("Win32_UserAccount.Name='"& profilename &"',Domain='wur'")
 
' Reads a REG_SZ value from the local computer's registry using WMI.
' Parameters:
'   RootKey - The registry hive (see http://msdn.microsoft.com/en-us/library/aa390788(VS.85).aspx for a list of possible values).
'   Key - The key that contains the desired value.
'   Value - The value that you want to get.
'   RegType - The registry bitness: 32 or 64.
'
Function ReadRegStr (RootKey, Key, Value, RegType)
    Dim oCtx, oLocator, oReg, oInParams, oOutParams
 
    Set oCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
    oCtx.Add "__ProviderArchitecture", RegType
 
    Set oLocator = CreateObject("Wbemscripting.SWbemLocator")
    Set oReg = oLocator.ConnectServer("", "root\default", "", "", , , , oCtx).Get("StdRegProv")
 
    Set oInParams = oReg.Methods_("GetStringValue").InParameters
    oInParams.hDefKey = RootKey
    oInParams.sSubKeyName = Key
    oInParams.sValueName = Value
 
    Set oOutParams = oReg.ExecMethod_("GetStringValue", oInParams, , oCtx)
 
    ReadRegStr = oOutParams.sValue
End Function

Set wshshell = CreateObject("WScript.Shell")

on error resume next

' Example writing HKCU registry.
wshshell.RegWrite "HKEY_USERS\"& objAccount.SID &"\Software\ACMEsoft\ACME\setting","testvalue", "REG_SZ"

Answered 10/30/2012 by: Rvlieburg
Third Degree Blue Belt

Please log in to comment
Answer this question or Comment on this question for clarity