Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting a registry key

Status
Not open for further replies.

bazcurtis

Technical User
Jul 11, 2001
134
GB
Hi,

I am trying to uninstall an old copy epolicy from my client machines. Some of them have failed despite running the uninstaller from a log script.

I know which reistry key I need to delete. How can I do this from a batch file. Could I just leave the key with no content, save it and imprt that to my clients. I know I can do that from a batch file, but obviously I would much rather delete the whole key.

Any solutions would be most helpful.

Best wishes

Michael Curtis
 
Michael,

You could create a vbscript file with the following contents and call it from a batch file.

Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegDelete "HKLM\SOFTWARE\TheSoftwareKeyIWishToDelete"



For Example:

WshShell.RegDelete "HKLM\SOFTWARE\Microsoft"

Would delete the entire Microsoft key. Not that I advise to do this one. Or if you dont want to delete the entire key but just the value

WshShell.RegDelete "HKLM\SOFTWARE\Microsoft\theValueIWishToDelete"

HTH

Clint
 
Try using Reg.exe from the resource kit. Here's the syntax:
c:\reg delete HKLM\software\microsoft\windows\currentversion\run \\%1 /force

\\%1 can be used as the variable to insert several machine names at a time from another batch file.

/force forces the deletion without user intervention.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top