Some users may be experiencing issues when trying to access customer resources like the Case Portal or the Product Licensing Center. Our team is aware of the issue and is working to resolve it. Click here for more information.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Remove a Registry Value

I am brand new to Admin Studio. I've messed with it to modify MSI files, but now I've got to do something totally different. I need to create an MSI or EXE that will only remove a registry value. We're using SMS to distribute this registry change. For whatever reason, SMS isn't receiving the appropriate exit code after running a batch file to remove the reg value. I don't know where to begin. I've searched the forum and can't find any information on how to do this.

Thanks.
(11) Replies
Instead of using the .bat extension, try .cmd
Make sure you have "exit" at the end of the routine.

name your file like this:
regremove.cmd

SMS should get the proper exit code then.
That's a good idea. I haven't tried the .cmd file. I'll give it a shot and let you know.

Thanks!
As an aside, if you do want to go down the MSI route, you might look into populating a record in the RemoveRegistry table...
That's true, too. If it needs to be done as part of a package and not a stand-alone deployment, that would be the best way to do it.
Robert, Do you know of any quick references for doing that? I tried it once and had a hard time because I didn't really understand the help page.
I don't have a great reference for it; looking at the MSI help topic for it, one tricky part is the component reference, where the registry value you specify will be removed when the component you select is installed. (This is strangely different from the RemoveFile table, which is generally used to remove extra files when the associated component is uninstalled.)
Thanks Robert,
Looking at the RemoveRegistry table in Direct Editor, you would add a new item, set the root to -1 if it's a local machine setting, then the Key field to the key you want removed and the Registry value name.
I believe the component reference could be RegistryData_Machine for HKEY_Local data.
The table actually has a dropdown with a handfull of choices for that field.
Worse case scenario is you might have to try them out to see which one works for the key you are removing.
Otherwise the other fields are kind of self explanantory.
The only remaining question is whether or not it will remove and entire key structure. I will be testing that part out when I have more time to play with it.
Changing the file name to .cmd (posix_fix.cmd) did not work. The client is not receiving an exit code. I did put an exit at bottom of the command. The cmd file looks like this:

regedit /s \\machinename\packdrop$\posix_RM\posix_fix.reg

Exit
this is not part of an existing MSI file. If it were, I would modify the transforms file with the registry update. is there no way to take a .reg file and turn it into an MSI?
I took another look and found the correct way the run the cmd command.
Apparently, you need to use the /c swtich in order for the exit code to function. Your command line should look something like this:

C:\windows\system32\cmd.exe /c C:\posix_fix.bat (or wherever the location of the this file is)

posix_fix.bat should contain your reg command:

regedit /s \\machinename\packdrop$\posix_RM\posix_fix.reg
Exit

This should work for you.
Unfortunately, this method only works on INSTALL. How do you make MSI remove a reg VALUE on uninstall (not the entire key, just a single value) that the MSI did not create? Maybe I'm missing something but I'm not seeing how to do it
Could you not create a component that delivers the value as blank? Then put a condition on the component: REMOVE=~ALL