Auto generate tasks to delete desktop shortcuts - REST API

I thought this would be easy and fun for me to automate, so I did.

Generally it is a bad idea to create desktop shortcuts when installing software on user’s machines because if they don’t have admin rights, they can’t actually delete the shortcuts off of the Public/Common Desktop.

It is better to prevent the shortcut from being created in the first place, or to delete it right after installing software, but there are many reasons it might be useful to be able to tell what desktop shortcuts have been missed and to be able to clean them up in an automated way. This is especially true for Lab computers in which there is less concern of deleting a shortcut the user actually wanted to be there, which is something to keep in mind for single user systems.

The resulting tasks could also be used in self-service so that users could choose to delete the desktop shortcuts if they wish, without the need for admin rights or IT intervention.


I created some relevance to get all of the shortcuts on the Public/Common Desktop: https://bigfix.me/relevance/details/3017219

unique values of names of files whose(name of it as lowercase ends with ".lnk") of (folders it) of unique values of (it as string as trimmed string) of values "Common Desktop" of keys "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" of (x64 registries; x32 registries)

This gets the location of the Common Desktop from the registry, then gets all files that end with .lnk in that location. I put this into an analysis property named Shortcuts on Public Desktop - Windows.


I then created some session relevance that would give all of the unique desktop shortcuts from the results of the above property: https://bigfix.me/relevance/details/3017221

unique values of values of results of bes properties whose(name of it contains "Shortcuts on Public Desktop")

From there, I created some complicated session relevance which actually returns the XML required to create a BigFix task to delete each one of the unique Desktop Shortcuts found.

The results of this session relevance query can be imported into BigFix to create the actual tasks that will delete the shortcuts.

Example Results:

1 Like