We have an old shortcut that has not deleted itself from a program we no longer use across all of our systems.  Is there a way to script the deletion of that file?  Its on some of the individual users' desktop.
1 Comment   [ + ] Show Comment

Comments

  • Try the scripts posted at

    http://www.itninja.com/question/can-kace-somehow-inspect-the-properties-of-an-application-shortcut-lnk
Please log in to comment

Community Chosen Answer

1
Yes, yes you can.

PowerShell, or your prefered scripting language would be best, NOT batch.

Hopefully the shortcut hasn't been renamed.

How I would go about: search the C:\users directory for the shortcut, if found then delete it. Put a exception in the code for the AllUsers directory.
This might help.
http://stackoverflow.com/questions/8677628/recursive-file-search-using-powershell


Run the script as local system or some account that has access, SYSTEM would be best as no ACL fiddle will need to be done. 

Answered 01/13/2016 by: rileyz
Red Belt

Please log in to comment

Answers

0
I ran this .bat file as an offline kscript to delete Office 2013 shortcuts. Not exactly what you are doing but may give you a starting point. 

======================================================================================

@echo off

Set scut="C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office 2013"

del /s /q /f %scut%\"InfoPath Designer 2013.lnk"

del /s /q /f %scut%\"InfoPath Filler 2013.lnk"

del /s /q /f %scut%\"Lync 2013.lnk"

del /s /q /f %scut%\"OneDrive for Business.lnk"

del /s /q /f %scut%\"OneNote 2013.lnk"

del /s /q /f %scut%\"Outlook 2013.lnk"

del /s /q /f %scut%\"Send to OneNote 2013.lnk"

Set scut="C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office 2013\Office 2013 Tools"


del /s /q /f %scut%\"Lync Recording Manager.lnk"

del /s /q /f %scut%\"Office 2013 Language Preferences.lnk"

del /s /q /f %scut%\"Office 2013 Upload Center.lnk"

del /s /q /f %scut%\"Telemetry Dashboard for Office 2013.lnk"

del /s /q /f %scut%\"Telemetry Log for Office 2013.lnk"

Answered 01/13/2016 by: rockhead44
Tenth Degree Black Belt

Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share