Question : Delete shortcut from all users desktop via script

Is there a quick script of bat file that I could use to delete a specific shortcut from all users desktop thourgh group policy using a script or bat file. The name of the shortcut to del is named "shortcut to table.exe"

Answer : Delete shortcut from all users desktop via script

I changed it to use a function.  Just call the function following it with the name of the shortcut in quotes like this.  Just remember that all shortcuts end with .lnk even though you dont see it.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strDesktopPath = objShell.SpecialFolders("Desktop")
strAllDesktopPath = objShell.ExpandEnvironmentStrings("%allusersprofile%")&"\desktop"

DelShorts "shortcut to table.exe.lnk"
DelShorts "table.lnk"

Function DelShorts(strShortcutName)
	If objFSO.FileExists(strDesktopPath & "\" & strShortcutName) then objFSO.DeleteFile strDesktopPath & "\" & strShortcutName
	If objFSO.FileExists(strAllDesktopPath & "\" & strShortcutName) then objFSO.DeleteFile strAllDesktopPath & "\" & strShortcutName
End Function
Random Solutions  
 
programming4us programming4us