SCCM PowerShell App and HKCU Registry Settings

Topics: Archive - General
Aug 27, 2014 at 5:32 PM
Edited Aug 27, 2014 at 5:32 PM
Hello

I am wondering how best to handle applications installations that require the HCKU keys to be modified when the users does not have administrative rights. I understand that when you run as Admin or use SCCM the current user registry keys become the Admin or system account. Is GPO or ActiveSetup the only options. Thank you in advance.
Aug 27, 2014 at 7:45 PM
Edited Aug 27, 2014 at 7:47 PM
Aug 28, 2014 at 4:36 PM
If the user is currently logged in and I need to alter their HKCU keys I use RunAsCurrentUser to execute a reg add or whatever.
http://software.bigfix.com/download/bes/util/RunAsCurrentUser-2.0.3.1.exe

Otherwise, I just use Group Policy Preferences to make those changes.
Aug 28, 2014 at 8:57 PM
Thank you both for the suggestions. I am pushing out Lync 2013 via SCCM and I added the code below. So far I think its working.

Create Active Setup to Update User Settings

Copy-File -Path "$dirSupportFiles\LyncUserSettings.cmd" -Destination "$envWindir\Installer\LyncUserSettings.cmd"
    Set-RegistryKey -Key "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{90150000-012B-0409-0000-0000000FF1CE}" -Name "" -Value "{90150000-012B-0409-0000-0000000FF1CE}" -Type String
    Set-RegistryKey -Key "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{90150000-012B-0409-0000-0000000FF1CE}" -Name "ComponentID" -Value "{90150000-012B-0409-0000-0000000FF1CE}" -Type String
    Set-RegistryKey -Key "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{90150000-012B-0409-0000-0000000FF1CE}" -Name "Version" -Value "15,0,4420,1017" -Type String
    Set-RegistryKey -Key "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{90150000-012B-0409-0000-0000000FF1CE}" -Name "StubPath" -Value "$envWindir\Installer\LyncUserSettings.cmd" -Type String
    Set-RegistryKey -Key "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{90150000-012B-0409-0000-0000000FF1CE}" -Name "Locale" -Value "EN" -Type String
Contents of "LyncUserSettings.cmd"

REG ADD "HKCU\Software\Microsoft\Office\15.0\Lync" /v TwoLineView /t REG_DWORD /d 0 /f
REG ADD "HKCU\Software\Microsoft\Office\15.0\Lync" /v ShowPhoto /t REG_DWORD /d 0 /f
REG ADD "HKCU\Software\Microsoft\Office\15.0\Lync" /v ShowFavoriteContacts /t REG_DWORD /d 0 /f
REG ADD "HKCU\Software\Microsoft\Office\15.0\Lync" /v MinimizeWindowToNotificationArea /t REG_DWORD /d 1 /f
REG ADD "HKCU\Software\Microsoft\Office\15.0\Lync" /v AutoOpenMainWindowWhenStartup /t REG_DWORD /d 0 /f

I based it on JNoxon post found here: http://psappdeploytoolkit.codeplex.com/discussions/470880