Started to learn Powershell recently and already found something really neat. I’m working on deploying Smartdraw 2016 silently and it loves to put an icon on the desktop of the user that it installing the program, not in C:\users\public\desktop where it belongs. Now, with SCCM, this use to be very tricky, because when running installs they run under the SYSTEM account and not as the logged in user and the native DEL /S command within the native CLI will do it, however, there’s no way to specify just one folder to delete from: it will search all folders under all of the user profiles.
Based on a tip from https://www.sapien.com/blog/2014/10/16/delete-desktop-icons-a-windows-powershell-tip/, we can do this instead:
Remove-Item "C:\users\*\Desktop\smartdraw ci.lnk"
which basically just searches the desktop folder of each user profile instead of all folders in each profile and deletes the now defunct Smartdraw CI icon from each desktop folder.
And now instead of looking for the uninstall productcode string to feed to MSIEXEC /x to remove Smartdraw CI: the PowerShell App Deployment Toolkit includes this nifty cmdlet do all of the heavy leaving all in one line:
Remove-MSIApplications -Name 'Smartdraw'
- Soli Deo Gloria