Welcome to the ScriptVault, where ScriptingAnswers.com users share their administrative scripts.

Have you written a script that accomplishes some administrative task? Please share it! Just navigate to the appropriate category and click the "Contribute to this category" link!

You are here: Top > Printing and Printers

Contribute to this category


Sub-Categories

(no categories are available)

 

Scripts

check Print Queue Status Contributed by Don Jones
Great for the Help Desk - user calls, printer isn't working - run this script to see what the issue is. Oh, you can replace the toner on your own, right?
Check print server queues Contributed by Don Jones
This script accepts a server name and then displays the status of all non-OK printer queues on that server. A great help desk tool so you can remotely check status and tell that user, "it's just the toner cartridge, you can change that yourself."
Migrate printers Contributed by Randy Foster
'This script works well in a login script. When ran from a workstation 'it will loop thru all of the printers installed for the current logged on 'user and if they are connected to the old server they will be removed 'and then remaped to the new server. It will also attempt to descover 'which printer is the default printer in order to reset this if it is one 'of the printers that will be moved.
Print Server Details Contributed by David Wills
This script generates a spreadsheet containing printer information. It can query one, or multiple servers. It reads a text file, "c:\printservers.txt", list of print server names, then attempts to open Excel, which must be present on the machine running the script. For each server in the input text file, the script queries * from Win32_Printer. It names workbook sheets, creates new sheets as needed, and fills each named workbook sheet with the corresponding server's printer information. You must have Power User or Administrator rights to successfully query servers in the list. The script saves the resulting spreadsheet as "c:\PrintServer details.xls", and prompts to overwrite the file, if it already exists. To change the input file name and/or source, change the line: "Set oTS = oFSO.OpenTextFile..." To change the output file name and/or destination, change the value of strExelPath. This script is based on the "Print Server Listing" script by Randy Reimers, and uses information provided by Christian Sawyer and Don Jones on www.scriptinganswers.com.
Print server listing Contributed by Randy Reimers
Access a print server, get information about all printers on the server, and build an Excel spreadsheet with the information. You must have power user or Administrator rights to the print server, and need to have Microsoft Excel installed on the PC you are running this from.
Remotely Add a Printer to a 2003 Server Contributed by Eddie Phillips

Have you ever wanted to consistently add a pritner to your printer server?


Now you can!
While this may not be the most polished script on the market, it is very functional. In our environment we have basically three kinds of printers that we install on our print servers.
    PCL Driver - Example Name = Printer1
    PS Driver - Example Name = Printer1_PS
    X-Driver - Example Name = XPrinter1
We use the X-driver when an older or more peculiar application needs an older HP driver. We use the HP Lasterjet III driver in these cases
This script will take all of these naming conventions into account. In order to configure the script for your environment; read the notes at the top of the script.
Remotely add local printer ports Contributed by Marshall
If you name the script RmtAddPort, the command "RmtAddPort computer1.domain printserver1.domain LibraryLaser" will add a local port on computer1.domain. The port will be called \\printserver1.domain\LibraryLaser. (Go to code snippet 1) This port does not become active until the Print Spooler on the remote machine is restarted. So, I incorporated a command to restart the spooler in my batch file that calls RmtAddPort. Then the batch file uses the rundll32 printui.dll,PrintUIEntry method to install a printer to the remote computer and point it to the new local port. The batch file is below: (Go to code snippet 2) Putting it all together, I only have to call the batch file as follows: "RmtAddPrinter.bat computer1.domain printserver1.domain LibraryLaser" This will add the local port to computer1.domain pointing to \\printserver1.domain\LibraryLaser. It will then stop and restart the spooler on computer1.domain. If a printer with the same name already exists, it will delete it. It will then install the printer on the remote computer, and copy the driver specified by the %DRIVER% variable from the path specified in the %DRIVERPATH% variable.