SHimmer45 Posted May 3, 2012 Posted May 3, 2012 (edited) Been tearing my hair out with this. we have several room which need the printers to be changed as the ports are going to be wrong when the servers are changed (ports names wrong) the printers are install as a local port printer with the port set to "\\servername\printersharename" so when you look at the port properties it says local port and then lists the share. i have tried using PRNadmin.dll and VBS but i get an error about the module not found (script is just installing a dummy to make sure the script functions as im not that good at scripting lol) dim oMaster dim oPrinter set oMaster = CreateObject("PrintMaster.PrintMaster.1") set oPrinter = CreateObject("Printer.Printer.1") oPrinter.PrinterName = "test_Printer" oPrinter.DriverName = "Epson T-1000" oPrinter.PortName = "lpt1:" oMaster.PrinterAdd oPrinter if Err <> 0 then 'An Error Occurred end if so looked at using prnport.vbs prnmngr.vbs which work but install the printer using direct IP which is not what is required. RUNDLL32 PRINTUI.DLL,PrintUIEntry doesnt appear to support local printing ports to shares? going round the houses so looking for a point on which is the better route to take. thanks Edited May 3, 2012 by SHimmer45
SHimmer45 Posted May 14, 2012 Author Posted May 14, 2012 Ok after some head scratching have managed to get PrintUI to play with local port printing. well its not actually installing the port itself but providing the port is already on the machine it can install a printer to it. so with a little addition to the registry with the new port names in my limited testing it appears to behave. sample code Adding a port: sc \\"PC_NAME" stop spooler REG ADD "\\PC_NAME\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports" /v \\SERVER_NAME\PRINTER /t REG_SZ sc \\"PC_NAME" start spooler then another bat file with rundll32 printui.dll PrintUIEntry /if /F "DRIVER_INFPATH" /b "Label of printer" /r "Printer Port Name" /m "Printer Name In Driver" /c\\PC_NAME gives 2 batches which are quite large (also added in options for removal of old printers and drivers) but seem to do the trick. id like to have been able to not have to keep creating the PC_Name each time and the script do that itself based on just being given a location and then going from 1-32 for each pc (so art-pc-1 - art-pc-31) anyway someone might find this useful if they are deploying local port printing. 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now