Removing desktop icons

jshipman
New Contributor III

Ok, so I made a classic mistake and selected a Smart Computer Group to send a policy, but didn't check the box next to Assign to Selected Computers and instead sent my policy to all Computers.

This isn't a huge deal because I was able to send out a policy to uninstall before much damage was done. But the installation was two AppleScript Applications that loaded onto the desktop. When I ran the uninstall as a policy (by indexing the package and then running a policy to uninstall the .dmg) it successfully uninstalled the applications but left an icon on the desktop that looks like the application symbol covered up by a prohibitory sign.

I could send out a command to move these to the trash (mv /Users/specificuser/desktop/file ~/.Trash/), but the problem is that I installed the package with FEU and FUT checked and the command would only remove them from a specific user. Any ideas would be greatly appreciated.

3 REPLIES 3

Nix4Life
Valued Contributor

you could write a do loop excluding adminShared accounts to remove the item from users desktop

LS

talkingmoose
Moderator
Moderator

I believe you can use a wildcard character to remove from all User home folders and then add a second command separated by a semi-colon to remove from the User Template:

rm -R /Users/*/Desktop/file ; rm -R /System/Library/User Template/English.lproj/Desktop/file

AdmiralBrains
New Contributor

I couldn't get rm to work for some reason but this worked, perhaps I have the extension (webloc for a browser shortcut) wrong?:

sudo find /users/*/desktop/ -name 'filenamewithoutextension' -delete