Jump to content

.Vbs printer scripts


Guest jwalkerRGS
 Share

Recommended Posts

Guest jwalkerRGS

Included is the script I am currently using on my network:

Set WshNetwork = CreateObject("WScript.Network")

PrinterPath = "\\WIZARD\CPK2LanierSW"

PrinterDriver = "LANIER LD075 PCL 5e"

WshNetwork.AddWindowsPrinterConnection PrinterPath, PrinterDriver

WshNetwork.SetDefaultPrinter "\\WIZARD\CPK2LanierSW"

The script populates the printer into the 'Printer and Faxes' folder and users can print all other documents except excel, mysterioulsly the print server drops the excel print job. The printers that I am having these issues on are the Lanier LD075 and LD060. I have rebuilt the script numerous times and still no luck with excel. Any assistance would be appreciated. :whistle: :">

Link to comment
Share on other sites

Below is what i use and printing out of excel hasnt been an issue

' Example to add a Printer using Direct IP

' PRINTER #1

' Put the hostname of the printer here

strPrinterHost = "namename"

' Put the name of the printer here

strPrinterName = "NAMENAME"

' Put the name of the printer driver here

strPrinterDriver = "HP LaserJet 4000 Series PCL"

' Create the printer port

Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

Set objNewPort = objWMI.Get("Win32_TCPIPPrinterPort").SpawnInstance_

objNewPort.Name = "IP_" & strPrinterHost

objNewPort.Protocol = 1

objNewPort.HostAddress = "namename"

objNewPort.PortNumber = "9100"

objNewPort.SNMPEnabled = False

objNewPort.Put_

' Add the printer

objShell.Run "%windir%\system32\cscript.exe %windir%\system32\prnmngr.vbs -a -p """ & strPrinterName & """ -m """ & strPrinterDriver & """ -r IP_" & strPrinterHost, 0 , True

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...