Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Remove Registry Entry via VBScript?


7 replies to this topic

Superfreak3

Superfreak3
  • Full Members
  • 437 posts

Posted 21 May 2004 - 21:50

Does anyone know of a way to remove a Registry key using VBScript?

Or, is there an InstallScript function to do this?

Any help would be greatly appreciated.

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 22 May 2004 - 04:27

You could take a look at this page (section delete key):
http://www.serverwat...cle.php/1476861

There also is a way to delete registry keys and values by calling regedit.exe from a reg file if this is more convenient for you and in Installscript it should certainly be possible.

Edited by Glytzhkof, 22 May 2004 - 04:28.

Regards
-Stein Åsmul

Superfreak3

Superfreak3
  • Full Members
  • 437 posts

Posted 23 May 2004 - 23:41

Is there any link for reference on using Regedit.exe to delete a key with a reg file?

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 24 May 2004 - 10:41

You need to call regedit.exe in silent mode passing in a reg-file that contains the key/value you want to delete with minus in front. Should be something like this:

QUOTE
regedit.exe /s filename.reg


To delete a registry key:
QUOTE

REGEDIT4

[-HKEY_CURRENT_USER\Software\Company\App\ARegistryKey]


Do delete a registry value:
QUOTE

REGEDIT4

[HKEY_CURRENT_USER\Software\Company\App\ARegistryKey]
"Dir"=-

Edited by Glytzhkof, 24 May 2004 - 10:59.

Regards
-Stein Åsmul

Superfreak3

Superfreak3
  • Full Members
  • 437 posts

Posted 24 May 2004 - 18:11

Based on your info, I called Regedit.exe from a CA using a directory path (directory table). The arguement was Regedit.exe /s MyFile.reg. The reg file, which I simply installed with this process, contained the Registry key I wanted to delete.

It seems to be working perfectly.

I still don't know why Developer8 seems to be adding an InprocServer32 Key to the registry entries for an ActiveX component we are installing. This wasn't the case using ISWI 2.03.

Oh well, I'll take the workaround!

wink.gif biggrin.gif wink.gif biggrin.gif



Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 25 May 2004 - 04:35

OK, glad you found something that works. One word of warning: I haven't tested this registry scripts on Windows 95, might not work.

Finally, if you get an InprocServer32 key in the registry I'd say there is something wrong with the Active X component's self-registration code. Usually ActiveX containers use ATL to define the self-registration code in a file with extension *.rgs. You could have a look in this file to see if you see an InprocServer32 value.
Regards
-Stein Åsmul

Perotin

Perotin
  • Full Members
  • 407 posts

Posted 25 May 2004 - 10:28

when using reg files, keep in mind that there has to be an empty line at the end of the file. otherwise the last line might not be written/deleted ...
Gruß / regards
Thomas

Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 25 May 2004 - 11:56

Thanks Perotin, I forgot that. And there is no end to the advice: remember to save the file as ANSI and not as Unicode (Windows 2000 and up often default to unicode), and make sure the first line reads:

"REGEDIT4"

and not

"Windows Registry Editor Version 5.00"

Otherwise the file is not readable on Win9X systems. Sorry for not mentioning this earlier.
Regards
-Stein Åsmul