Mombu the Microsoft Forum

  Mombu the Microsoft Forum > Microsoft > Windows 2003 Server (TECHNET) > Deleting a registry key


User Name
Password
REGISTER NOW! Search Today's Posts Mark Forums Read


Reply
 
Thread Tools Search this Thread Display Modes
1 13th July 09:28
axel strasser
External User
 
Posts: 1
Default Deleting a registry key



In a msi I am trying to delete a registry key (with all subkeys and values).
I don't know how many subkeys and values are existing.

First I have tried to do it with the RemoveRegistry tabelle, but there it is
necessary to define each singel item.

Than I have tried it with a custom action:

'--------------------------------------------------------
Sub DeleteKey (key) ' key is the keyname
Const tmpFolder = 2
Const ForWriting = 2

Dim oFso, oFile
Dim tmp, path

Set oFso = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject ("WScript.Shell")
tmp = oFso.GetTempName
path = oFso.GetSpecialFolder(tmpFolder)
tmp = path & "\" & tmp

Set oFile = oFso.OpenTextFile(tmp, ForWriting, true)
oFile.WriteLine ("Windows Registry Editor Version 5.00")
oFile.WriteLine ("")
oFile.WriteLine ("[-" & key & "]")
oFile.WriteLine ("@=""""")
oFile.Close
Set oFile = Nothing

command = "C:\WINDOWS\Regedit.exe /s """ & tmp & """"
WshShell.Run command, 4, true
msgbox command
' oFso.DeleteFile tmp
End Sub
'--------------------------------------------------------

This will not work inside a msi. If I am using the command manually in an
cmd window (same syntax, same file) than it is working.

Are there some other ideas to resolve this task ?

Axel
  Reply With Quote
SPONSORED LINKS BY GOOGLE

 


2 13th July 09:29
kalle olavi niemitalo
External User
 
Posts: 1
Default Deleting a registry key



"Axel Strasser" <strasser_a@hotmail.com> writes:

The documentation says you can set RemoveRegistry.Name='-' to
delete all subkeys and values.

http://msdn.microsoft.com/library/en...stry_table.asp
  Reply With Quote
SPONSORED LINKS BY GOOGLE

 


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes







Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
Also visit Ogoun the Usenet Archive
666