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?
Answers (9)
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.
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.
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
)
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
>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.