Trying to cleanup registry entries after an unistall

sreeranga_vs
sreeranga_vs used Ask the Experts™
on
I had visio installed and afer an unistall it leaves few registry entries behind. I wanted to clean the same up using a script. I had used vb script and windows scripts a long time back and have forgotten.

I am using the below script. When I do so i am getting an error "Invalid root in registry key " at Line 6 char 1 . Error code is 800700003; Source is WshShell.RegDelete.

Can anyone please help...

Dim WshShell , cal1
 
Set WshShell = WScript.CreateObject("WScript.Shell")
cal1 = "\HKLM\SOFTWARE\classes\.vst\"
WScript.echo "xxxxxxxx: " & Cal1
WshShell.RegDelete cal1
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
I would guess that the error is the "\" at the begining of the line:
cal1 = "\HKLM\SOFTWARE\classes\.vst\"

Open in new window

 I think it should be:
cal1 = "HKLM\SOFTWARE\classes\.vst\"

Open in new window

 Is the slash at the end also required??

Hope that helps

Priz
I would personally use a reg cleaner like CCleaner to correct the registry after an uninstall.  It's very good at finding lingering entries after an uninstall, and will prompt you to make a backup before any changes.  You can download it from here:

http://www.filehippo.com/download_ccleaner/download/59834dc473299e9dcc82cfca1f499481/

Author

Commented:
hello Pr1z,
"\" at the beginning of the line was a typo....
slash at the end is required....
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Hello epichero22,

Thanks for the Info... I do make use of  reg cleaner but I wanted the script.

Commented:
Can you copy and paste all of the source code, the error says line 6 but there are only 5 lines in your code snippet.  Please use the "code" button on the toolbar to make it easier for everyone to read.

Thanks

Priz

Author

Commented:
Theres a blank line between DIM and Set ..


Dim WshShell , cal1
 
Set WshShell = WScript.CreateObject("WScript.Shell")
cal1 = "\HKLM\SOFTWARE\classes\.vst\"
WScript.echo "xxxxxxxx: " & Cal1
WshShell.RegDelete cal1 

Open in new window

This should work...

Dim WshShell , cal1
 
Set WshShell = WScript.CreateObject("WScript.Shell")
cal1 = "HKLM\SOFTWARE\classes\.vst\"
WScript.echo "xxxxxxxx: " & Cal1
WshShell.RegDelete cal1 

Open in new window

Author

Commented:
HI jared_luker
i tried it and it does not work. I get a message  line 6 char 1 Unable to remove registry key. code 80070002.
You need to run the script as an admin.  Either right click and say "run as administrator" or open up an admin command prompt and run it with cscript

Author

Commented:
Hello jared_luker

I am logged in as an administrator on my virtual machine.
Just being logged in as an admin is not enough on Win Vista and above.  You need to specifically run the process as an administrator.  I ran the same script I provided above and it did not work until I ran it as an admin.
From:  http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/XP/Q_26743874.html

[Icons moving around], never found a method to prevent it, but an easy fix.....

Save/Restore Desktop icons POSITION with two small Scripts
http://www.autohotkey.com/forum/topic28677.html

Dips S to save it....
Dips R to restore....

Saves the config of the icons to HKCU\Software\Richter, which can also be transfered to another user profile/machine. I keep a shortcut to Restore and to Save, so if I have RDPd into this machine and got the icons out of whack across both monitors, I can easily restore them.....

That Echo's my experience as well.  I was never able to find a way to prevent it, but that is an easy solution so that the users can be enabled to help themselves.
Oops... sorry... posted that last one in the wrong question
Dirk HaestProject manager

Commented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial