Remove depricated thin client application

I want to create a powershell script that will remove a specific desktop shortcut from users desktops.  the catch is the shortcuts might be named differently, but they are all pointing to the same name application.  Could someone provide me with a sample...

Or.. maybe some other solutions/methods of removing the deprecated application?  GPO/MSI uninstaller?  Powershell?
tike55Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dustin SaundersDirector of OperationsCommented:
You use Powershell to create a shell object and check the path.  Assume the shortcut has any different name but the $checkPath is "C:\test\targetToDelete.exe".
shortcut.png
$checkPath = "C:\test\targetToDelete.exe"

$path = [Environment]::GetFolderPath("Desktop")
$shortcuts = Get-ChildItem -Recurse $path -Include *.lnk
$shell = New-Object -ComObject WScript.Shell

foreach ($shortcut in $shortcuts)
{
    if($shell.CreateShortcut($shortcut).TargetPath -eq $checkPath)
    {
        Remove-Item $shortcut -WhatIf
    }
}

Open in new window


You can see it found the associated .lnk file and would remove it.  
What if: Performing the operation "Remove File" on target "C:\Users\dsaunders\Desktop\COULD BE NAMED ANYTHING.lnk"

Open in new window


Update the path in $checkPath to whatever the target you want to audit is.  You can test run as is, then delete the -WhatIf out of this line:
Remove-Item $shortcut -WhatIf

Open in new window

To have it actually remove the file.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dustin SaundersDirector of OperationsCommented:
No response from asker, but functional code and method to complete request.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.