Hi,
I'd be happy to help you out with your question. Sorry for the inconvenience caused.
You can use a Group Policy Object (GPO) to delete all shortcuts that point to a specific executable by configuring a script that runs at startup. Here's how to do it:
- Create a new Group Policy Object in your domain and link it to the appropriate Organizational Unit.
- Edit the Group Policy Object and go to User Configuration > Policies > Windows Settings > Scripts (Logon/Logoff).
- Click on the "Show Files" button under the Logon Scripts section to open the Logon folder.
- Right-click inside the Logon folder and select New > Text Document.
- Rename the new text document to "Delete_Shortcuts.bat".
- Open the "Delete_Shortcuts.bat" file with a text editor (such as Notepad).
- Copy and paste the following code into the "Delete_Shortcuts.bat" file:
@echo off
for /f "delims=" %%i in ('dir /s /b "%USERPROFILE%*.lnk"') do (
if "%%~nxi"=="<name_of_shortcut>.lnk" (
echo Deleting shortcut: "%%i"
del "%%i"
)
)
- Replace "<name_of_shortcut>" with the name of the executable that the shortcuts point to. For example, if the shortcuts point to "C:\Program Files\Microsoft Office\Office16\WINWORD.EXE", then replace "<name_of_shortcut>" with "WINWORD".
- Save and close the "Delete_Shortcuts.bat" file.
- Go back to the Group Policy Object editor and click on the "Add" button under the Logon Scripts section.
- Click on the "Browse" button and select the "Delete_Shortcuts.bat" file that you just created.
- Click on "OK" to save the changes.
Now, every time a user logs in, the script will run and delete all shortcuts that point to the specified executable.
For more Information, Please refer to following resources :-
- delete/update shortcut thru preferences - https://social.technet.microsoft.com/Forums/ie/23aafe2a-a1bb-4001-ad60-ed4565ac4e11/deleteupdate-shortcut-thru-preferences?forum=winserverGP
- Create a GPO to run only once to Delete desktop shortcuts - https://social.technet.microsoft.com/Forums/systemcenter/82c69e04-1232-41f4-9550-95ff96259672/create-a-gpo-to-run-only-once-to-delete-desktop-shortcuts?forum=winserverGP
- How to remove shortcut from \All Users\Desktop - https://social.technet.microsoft.com/Forums/exchange/cb240d02-d3ae-4694-802c-6e3be0c72c39/how-to-remove-shortcut-from-all-usersdesktop-when-you-know-the-shortcuts-target?forum=ITCG
If you have any other questions or need assistance with anything, please don't hesitate to let me know. I'm here to help.
If the reply was helpful, please don’t forget to upvote or accept as answer, thank you.