Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Scripting Client Upgrades
> Can you please share the experience how to delete Windows
> registry value
> (parameter) or even whole branch using scripting.
> Sorry for basic question.
> I know how make new entries in Win registry,
> even able to update, but there knowledge hole regarding deleting.
This small example is done in Windohs native scripting (abomination is better term) known as Visual Basic Script:
' ////////////////////////////////////////////////////////////////////' FileName: DemoRmoveKey.vbs
' ////////////////////////////////////////////////////////////////////
Sub RemoveKey(gcsKeyToDelete)' removes passed registry key
Dim oShell
Set oShell = CreateObject("Wscript.Shell")
On Error Resume Next
oShell.RegDelete gcsKeyToDelete
If Err.Number Then
MsgBox "Error # " & CStr(Err.Number) & " " & Err.Description Else
MsgBox "Removed registry key", vbInformation, gcsKeyToDelete
End If
End Sub
' Uncomment next line and kiss your ORACLE registry key good bye: 'CONST sKeyToRemove = "HKLM\SOFTWARE\ORACLE\"
' But this is OK to try since there is no such key in your registry,
' make it manually and see what happens:
CONST sKeyToRemove =
"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\XYZ\"
RemoveKey sKeyToRemove
While removing known registy key is trivial, enumerating registry keys is not. You'd need to be familiar with another horrid object model - the notorious WMI to pull trick like this (straight from note 124353.1):
3.g. Go to HKEY_CLASSES_ROOT, remove all keys that begin with Ora or ORCL (e.g. Oracle..., ORADC..., ORAMMC..., OraOLE..., OraPerf... and ORCL...).
For kinky details on WMI have a look at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnclinic/ht
ml/scripting06112002.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/
wmi_start_page.asp
Another place to have a look at since you can get some working examples: http://www.microsoft.com/technet/community/scriptcenter/default.mspx
Forgetting about Winodohs natives, move to wonderful world of Python or Perl and be able to do more magic with lesser amount of effort and far less headaches...
Branimir
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------Received on Tue Jul 06 2004 - 12:00:12 CDT
![]() |
![]() |