/build/static/layout/Breadcrumb_cap_w.png

Delete registry fo all users

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

Answers (9)

Posted by: jagadeish 11 years ago
Red Belt
2

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

Posted by: anonymous_9363 11 years ago
Red Belt
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.

Posted by: lanselots 11 years ago
Fifth Degree Brown Belt
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.

Posted by: lanselots 11 years ago
Fifth Degree Brown Belt
1

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

Posted by: M P 11 years ago
Purple Belt
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
)

Posted by: anonymous_9363 11 years ago
Red Belt
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.

Posted by: lanselots 11 years ago
Fifth Degree Brown Belt
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

Posted by: sumitsingh1984 11 years ago
Second Degree Green Belt
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

Posted by: anonymous_9363 11 years ago
Red Belt
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.

 
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