I was wondering if any of you might know if it's possible to set the default printer, on a large number of machines, to the LPT port with vbscript. Any help would be greatly appreciated.
i think you might be able to use the MapNetworkDrive function, hmm using LPT1 instead of the drive letter?
perhaps not, perhaps you might be stuck with using the shell
WshShell.Run "NET USE LPT1:....etc", 1, True
returning the default printer, i think this was one of tsuji's posts
defaultprtr=0 'error-less return
prtrname="" 'out-param
on error resume next
set svc=getobject("winmgmts:\\" & shost & "\root\cimv2")
set cprtr=svc.execquery("select name, attributes from win32_printer")
for each oprtr in cprtr
if (oprtr.attributes and &h04)=&h04 then prtrname=oprtr.name : exit for
next
if err.number<>0 then defaultprtr=err.number : err.clear : prtrname=""
on error goto 0
set cprt=nothing : set svc=nothing
I forgot to mention this is as well.....This needs to be done without using the name of the printer that is connected to LPT1, becuase each printer that is connected to the LPT port o n the various machines might be named something different....so to refresh:
Need printer on every machine set to LPT1 without using the name of the printer.
Once again any comments would be greatly appreciated!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.