Hi,

Is there a way to delete registry key under HKCU for all users when launching deployemnt through SCCM, because how far I know when launching installation through SCCM it will happen (deleting reg) only for admin but not for user, so is there a way to do that when launching installation it also removes registry for all users which has used that machine?

0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Community Chosen Answer

2

You can write a VBScript to read the User's SID and delete the keys from HKEY_USERS hive..

Answered 03/05/2013 by: jagadeish
Red Belt

Please log in to comment

Answers

1

If the package you are deploying contains any advertised entry-points, e.g. an advertised shortcut, you can create a new user-level feature containing the registry deletion and then move the feature which contains the shortcut so that it becomes a child of the new feature. Thus, when the entry-point is used, self-healing is triggered.

If there are no advertised entry-points, use Active Setup.

Answered 03/05/2013 by: VBScab
Red Belt

Please log in to comment
1

The thing is that registry need to be deleted before application is started to install and that registry is located under HKCU, so I have script which doint that manually launching but if that will be launched through SCCM then that will happen only for Admin user not current which is launching installation. If that make sense.

Answered 03/05/2013 by: lanselots
Fourth Degree Brown Belt

Please log in to comment
1

Sound easy to you to write script, but I`m not so big script master so have no idea how to do that.

Answered 03/05/2013 by: lanselots
Fourth Degree Brown Belt

Please log in to comment
1

I am not exactly sure what software you are installing, so the script below will need to be modified to meet the needs a little bit.  In the bottom portion of the script you will see the line with this:
"%SYSTEMROOT%\SYSTEM32\REG.EXE DELETE "HKLM\TempHive\Software\Microsoft\RandomKey" /f"
Update the path after "HKLM\TempHive" to the path of the key you would like to delete, just like it was "HKCU" or "HKEY_CURRENT_USER" in the Registry Editor.  Let me know if you have any questions.

@ECHO OFF
REM Determine Operating System for folder (5.x - XP/2003, 6.x - Vista/Above)
VER | FIND /I "[Version 5." >nul && (SET sProf=Documents and Settings) || (SET sProf=Users)
CD "%SYSTEMDRIVE%\%sProf%"

FOR /F "tokens=*" %%i IN ('dir /b /ad') DO (
 IF EXIST "%SYSTEMDRIVE%\%sProf%\%%i\NTUSER.DAT" CALL :DeleteRegValue "%%i" ".\%%i\NTUSER.DAT"
)

:DeleteRegValue
SET UPD=Y
IF /I %1 equ "All Users" SET UPD=N
IF /I %1 equ "LocalService" SET UPD=N
IF /I %1 equ "NetworkService" SET UPD=N
IF /I %1 equ "Default User" SET UPD=N
IF /I %1 equ "Default" SET UPD=N
IF /I %1 equ "Public" SET UPD=N

IF %UPD% equ Y (
 REM Load the registry hive to HKEY_LOCAL_MACHINE\TempHive
 %SYSTEMROOT%\SYSTEM32\REG.EXE LOAD HKLM\TempHive %2
 
 REM Delete the desired registry key and all of its subkeys
 %SYSTEMROOT%\SYSTEM32\REG.EXE DELETE "HKLM\TempHive\Software\Microsoft\RandomKey" /f
 
 REM Unload the registry hive
 %SYSTEMROOT%\SYSTEM32\REG.EXE UNLOAD HKLM\TempHive
)

Answered 03/05/2013 by: M P
Purple Belt

Please log in to comment
This content is currently hidden from public view.
Reason: Removed by member request
For more information, visit our FAQ's.

0

...so build a package which deals with just the registry deletion and make the actual package a dependency of that. Or build a Task Sequence if you prefer that route.

Answered 03/05/2013 by: VBScab
Red Belt

Please log in to comment
0

Let me start from different side,

my current package installs from dvd installer and runs it from setup.exe, before that users get prompted that version which is instaled need to be removed, but it leaves some registry behinde under HKCU so that need to be removed before installation starts, and cannot change MSI or MST as that will broke installation. and that is guys AuotCAD 2010 :d

Answered 03/05/2013 by: lanselots
Fourth Degree Brown Belt

Please log in to comment
0

Hi,

You can run your script in user mode; I think there is an option in SCCM to run tasks with standard user privilege.

 

Sumit

Answered 03/06/2013 by: sumitsingh1984
Second Degree Green Belt

Please log in to comment
0

>cannot change MSI or MST as that will broke installation
Er...why would that be? What do you imagine packagers do, day-in and day-out but create transforms for vendor MSIs?!?!

Anyway, what was wrong with my suggestion above, i.e.:

...so build a package which deals with just the registry deletion and make the actual package a dependency of that. Or build a Task Sequence if you prefer that route.

Answered 03/06/2013 by: VBScab
Red Belt

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