Scripts Thread, VBS Printer Scripting install Printer to a local port (network share) in Coding and Web Development; Been tearing my hair out with this.
we have several room which need the printers to be changed as the ...
3rd May 2012, 01:59 PM #1
VBS Printer Scripting install Printer to a local port (network share)
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)
set oMaster = CreateObject("PrintMaster.PrintMaster.1")
set oPrinter = CreateObject("Printer.Printer.1")
oPrinter.PrinterName = "test_Printer"
oPrinter.DriverName = "Epson T-1000"
oPrinter.PortName = "lpt1:"
if Err <> 0 then
'An Error Occurred
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.
Last edited by SHimmer45; 3rd May 2012 at 02:00 PM.
IDG Tech News
14th May 2012, 02:17 PM #2
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.
By fawkers in forum Windows
Last Post: 23rd May 2012, 12:43 AM
By SimpleSi in forum Windows 7
Last Post: 5th October 2011, 04:41 PM
By Andi in forum Thin Client and Virtual Machines
Last Post: 23rd September 2008, 12:19 PM
By tosca925 in forum Scripts
Last Post: 14th June 2008, 01:18 AM
By CM786 in forum Windows
Last Post: 11th July 2006, 08:37 PM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)