Sign in to follow this  
Followers 0
vatobeto

Automatically Remove Orphan Vista Desktop Icons

5 posts in this topic

Hi

I recently wrote a Vista unistaller for a program, which calls the UninstallString in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

Unfortunately, the desktop icon is left behind and I don't want the user to have to

manually clock on it and remove it - sort of defeats the whole point of automation.

Where are these icons located and I can I remove them from a script. The icons

in the user folders are useless for this.

THX, vatobeto (Code to follow)

CODE
#RequireAdmin

$regkey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\DVD-lab PRO 2.5_is1"

$regvalue = "UninstallString"

$installDir = @ProgramFilesDir & "\DVDlabPro2"

$recurse = 1

$UIS = RegRead($regkey, $regvalue)

Run($UIS)

sleep(4000)

DirRemove($installDir, $recurse)

Share this post


Link to post
Share on other sites



You'll simply need to perform a FileDelete() on the shortcut file. It's either in the user's profile (C:\Documents and Settings\username\Desktop\Shortcutname.lnk) or in the All Users profile (C:\Documents and Settings\All Users\Desktop\Shortcutname.lnk). There are also variables in AutoIt for these directories - @DesktopDir, for instance, will return the current user's desktop path.


Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt

Share this post


Link to post
Share on other sites

You'll simply need to perform a FileDelete() on the shortcut file. It's either in the user's profile (C:\Documents and Settings\username\Desktop\Shortcutname.lnk) or in the All Users profile (C:\Documents and Settings\All Users\Desktop\Shortcutname.lnk). There are also variables in AutoIt for these directories - @DesktopDir, for instance, will return the current user's desktop path.

That's for XP, isn't it? I thought Documents and Settings is now an admin only directory blocked from user access in Vista.

Share this post


Link to post
Share on other sites

That's for XP, isn't it? I thought Documents and Settings is now an admin only directory blocked from user access in Vista.

Sorry, I've still got XP on the brain. =)

User profiles are structured similarly; it's just C:\Users instead of C:\Documents and Settings.


Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt

Share this post


Link to post
Share on other sites

Sorry, I've still got XP on the brain. =)

User profiles are structured similarly; it's just C:\Users instead of C:\Documents and Settings.

Thank you - that helps a lot! :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0