I'm looking for a script to remove a .lnk file that was placed on every user's desktop. I installed a program on a terminal server that put a .lnk file on every user's desktop, rather than putting one shortcut in the "Public" desktop folder. I have since removed the program, but now I need a script to remove the shortcut from each user's desktop. Any help is much appreciated, thanks!
why a script? if this is just 1 terminal server you should just be able to run:
then add the shortcut back to the public desktop.
EDIT: Well that will teach me to post a command that doesn't work... Seemed like it would though... Anyway, I updated with a command that will work. You may have to run from an administrative command prompt though. NOTE (from comments on this answer): this will also delete the shortcut.lnk file anywhere under the c:\users directory structure. You can change the "del @path" to "dir @path" to make sure of the files before deleting them.
|show 1 more comment|
Maybe something like this?
Save as a .bat and run something like this.
This will go through C:\Users recursively and remove the specified shortcut from all users desktops.