The code below receives a printer link file path as an argument to the script, it then reads the link files target path and tries to connect to the printer that the target path points to. However, reading the link targetpath only works for a directory link and I assume a file link also. With the code below, I can't seem to be able to read the target path of a link that links to a printer. Does anyone here know how to do it?
Dim strLinkFullname, strShortcut, strShortTarget, objNetwork, oShell
Set oShell = wscript.createObject("wscript.shell")
Set objNetwork = CreateObject("WScript.Network")
strLinkFullname = WScript.Arguments(0)
Set strShortcut = oShell.CreateShortcut(strLinkFullname)
strShortTarget = strShortcut.TargetPath
Wscript.Echo "Trying to connect the printer: " & strShortTarget