/build/static/layout/Breadcrumb_cap_w.png

Script needed to delete registry key value

My application is related to Add-In. I want to delete a registry value data from Current User.

First I will say the scenario of my application.
I have installed one add-in application then it is creating one current user entry ie.,.HKCU\Software\Microsoft\Office\11.0\Excel\Options Open="Path of .xla file".
After this I installed my application then it is creating one current user entry ie,.
HKCU\Software\Microsoft\Office\11.0\Excel\Options Open1="Path of my application .xla file".

During uninstallation I need to delete only Path of .xla file not Open. Because We dont know how many Add-In applications are installed before installing my application.


So I need a script to delele Data in Registy Key.ie,. Path of .xla file.

0 Comments   [ + ] Show comments

Answers (11)

Posted by: volantedesktop 15 years ago
Senior Yellow Belt
0
Hopefully this will help you:

Const HKEY_CURRENT_USER = &H80000001
strComputer = "."

Set objRegistry=GetObject("winmgmts:\\" & _
strComputer & "\root\default:StdRegProv")

strKeyPath = "Software\Test"
strValueName = "Sample Value 1"
objRegistry.DeleteValue HKEY_CURRENT_USER, strKeyPath, strValueName

Also got to this website and download the archives... Very handy for reference:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/hsgarch.mspx
Posted by: sanhivi 15 years ago
Third Degree Green Belt
0
Thank u for ur reply.

I used this script but it is deleting the Open (Stringvalue). But I want to delete only data in Open.ie,.C:\ProgramFiles\Panopticon\abc.xla

Name Type Data
Open REZ_SZ C:\ProgramFiles\Panopticon\abc.xla

Could U just give me the solution for this.
Posted by: anonymous_9363 15 years ago
Red Belt
0
No, no, no, no, NO! NEVER use the 'Open' value when dealing with XL add-ins, and you should certainly avoid hard-coded Office versions in script. Use XL's Automation to add and remove its add-ins. Search *this* forum for 'Excel' and 'add-in' and you'll find examples. Or, if all else fails, there's a search thingy called 'Google' which is proving quiote popular these days.

Now, what on earth does this:
ORIGINAL: sanhivi
Name Type Data
Open REZ_SZ C:\ProgramFiles\Panopticon\abc.xla
mean? That isn't a script. What is it?

Also, why on earth do you want to remove only the data in that entry? I could understand if you wanted to replace it. If you leave it there with no data and the user subsequently adds another add-in, XL is going to become confused, as will the user when he opens the add-ins menu and sees a blank entry in his list of available add-ins.
Posted by: Ram 15 years ago
Senior Purple Belt
0
Hi we can also do this way. Import the registry key you wanted to delete and save it as xyz.reg and edit the the registry key by adding '-' for example
[-HKEY_CURRENT_USER\Software\xyz]

add command

regedit.exe /s xyz.reg

Does the work for you.

Regards,
Ram.
Posted by: anonymous_9363 15 years ago
Red Belt
0
ORIGINAL: Ram
Does the work for you.
...yeh, except it's not the work which the OP wants. Your method deletes the entire key, whereas the OP wants (for some bizarre reason) to remove the entry's data.
Posted by: ratheeshtravi 15 years ago
Yellow Belt
0
Hi,
try this....

use wise script editor
go to edit registry
Add a registry key under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components
create a new stubpath
and create a new value
reg.exe delete "HKCU REGISTRY PATH" /v /F
Posted by: anonymous_9363 15 years ago
Red Belt
0
...which, just like the previous example, deletes the value. The OP wants - for reasons I am unable to fathom - to delete the value's data.
Posted by: sayeenath@gmail.com 15 years ago
Yellow Belt
0
Set Sh = CreateObject("WScript.Shell")
key = "HKEY_CURRENT_USER\"
Sh.RegWrite key & "Software\Microsoft\Office\11.0\Excel\Options\Open", ""

Try the above one. is this are you looking for ...
Posted by: anonymous_9363 15 years ago
Red Belt
0
Set Sh = CreateObject("WScript.Shell")
key = "HKEY_CURRENT_USER\"
Sh.RegWrite key & "Software\Microsoft\Office\11.0\Excel\Options\Open", ""
Again, a hard-coded Office version number (BAD idea) and an assumption that the add-in is in the first position (add-ins are referenced as 'Open' for the first, 'Open1' for the second, 'Open2' for the third and so on.
Posted by: OriginalM 15 years ago
Senior Yellow Belt
0
Hi,
don't know if you have already a solution.
The simpliest way is to use REG ADD in the following way.

REG ADD "HKCU\Software\Microsoft\Office\11.0\Excel\Options" /V "Open1" /T REG_SZ /F

So the existing entry will be overwritten with an empty value.
Posted by: anonymous_9363 15 years ago
Red Belt
0
REG ADD "HKCU\Software\Microsoft\Office\11.0\Excel\Options" /V "Open1" /T REG_SZ /F Aaaaaaaaaaand, yet again, a hard-coded Office version number (BAD idea) and an assumption that the add-in is in the first position (add-ins are referenced as 'Open' for the first, 'Open1' for the second, 'Open2' for the third and so on. )
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
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