I want to create a script to delete any desktop shortcut that has a target that starts with \\Serv1\
I was able to create a script to create a shortcut but how can I modify it to delete the shortcut that has a target path that starts with \\Serv1\?
The reason why is because the name can be anything but the path will always start with \\Serv1\
Newbie in search of knowledge
I was able to create a script to create a shortcut but how can I modify it to delete the shortcut that has a target path that starts with \\Serv1\?
The reason why is because the name can be anything but the path will always start with \\Serv1\
Code:
Set WshShell = CreateObject("WScript.Shell")
set objFSO = CreateObject("Scripting.FileSystemObject")
strDesktop = WshShell.SpecialFolders("Desktop")
IF Not objFSO.FileExists(strDesktop & "\Company on Serv1.lnk") THEN
set oShellLink = WshShell.CreateShortcut(strDesktop & "\Company on Serv1.lnk")
oShellLink.TargetPath = "\\CHCB8\Company"
oShellLink.WindowStyle = 1
oShellLink.Description = "Shortcut to Company on CHCB8"
oShellLink.WorkingDirectory = "\\Serv1\Company"
oShellLink.Save
set oShellLink = NOTHING
END IF
Set WshShell = NOTHING
Set objFSO = NOTHIN
Newbie in search of knowledge