Jump to content

Recommended Posts

Posted

For the past several years I've been using a great little script provided by someone on here to map print queues as below :

 

'Name : addprinter.vbs
'Author : Matt Davies
'Date : 22/03/2006
'Description :  - Used to add printers for a user
'   - Used inconjunction with group policy at Workstation level so it runs per room
'   - Needs to be run under "USER" Logon scripts 
Option Explicit
Dim objNetwork
'declare the printer names - add as necessary
Dim strUNCPrinter1
'Dim strUNCPrinter2
'set the UNC path to the printers you want mapped - add as necessary
strUNCPrinter1 = "\\papercut\PullPrinter"
'strUNCPrinter2 = "\\ygg-printers\5170-Cymraeg"
Set objNetwork = CreateObject("WScript.Network")
'remove old printer(s) first
'for debugging comment out next line only
on error resume next
objNetwork.RemovePrinterConnection strUNCPrinter1
'objNetwork.RemovePrinterConnection strUNCPrinter2
'Wait 3 seconds whilst windows removes the old printers
wscript.sleep(3000)
'Add the printer to the computer - add as necessary
objNetwork.AddWindowsPrinterConnection strUNCPrinter1
'objNetwork.AddWindowsPrinterConnection strUNCPrinter2
' Here is where we set the default printer - change if necessary
objNetwork.SetDefaultPrinter strUNCPrinter1
'End the script
Wscript.Quit

 

We recently got new MFDs and whilst this script still does the job, the problem is the user can log in, open Chrome / Word etc before the script has done it's business (I suspect the new MFD driver is larger than the old one too) and therefore go to print and end up having a default printer of 'Save to PDF' etc! (If they close the program then open it back up obviously the correct default will be then set, but especially with the newer computers they can be in to their programs very quickly after logging in!).

 

Is there anything else out there that works reliably these days? Realistically the printer needs to be pulled down and set as default before the user is at the desktop opening their programs.

Posted

I think this might be the problem:

'Date : 22/03/2006

 

Perhaps try group policy (point and print) with OU's set as room numbers / departments

  • Thanks 1
Posted (edited)

I use something similar at my schools but my script checks what OU the machine is in and maps different printers accordingly. Works well and we have MFD's too. Perhaps delete the lines that remove the printer as you are adding the same printer again anyway.

 

Edit: also delete the 3 second delay as that won't be needed anymore.

Edited by Jobos
  • Thanks 1
Posted

Thanks for the advice, I know the script is old but like I said it has been working for years so haven't needed to really look at it until the new MFDs turned up!

 

What we have is the main MFD pull queue which 80% of our rooms (OUs) use, then there are a few rooms with a stand alone HP printer (These are also networked and on the print server so no worries there). So just a more robust way to map a printer depending on OU and setting it as the default before the user gets to the desktop really.

 

I'm fairly sure I tried GPP in the past (Win 7 / 2008 R2 environment) but it was a bit hit and miss and didn't seem to remove printer queues from users if they logged in elsewhere (So for example if a user was based in a room with a HP printer and they then went to use a room with the MFD pull queue they would still get mapped to the HP printer!)

Posted

I made printer install scripts as follows...

cscript c:\windows\system32\printing_admin_scripts\en-us\prnmngr.vbs -x

cscript c:\windows\system32\printing_admin_scripts\en-us\prnmngr.vbs -ac -p \\SERVERNAME\PRINTERNAME

cscript c:\windows\system32\printing_admin_scripts\en-us\prnmngr.vbs -t -p \\SERVERNAME\PRINTERNAME

 

Creates the printer and sets it as default. Works quick (user sees it for a couple of seconds). I then made it into a cmd file and used group policy to push it out with OU targeting to the computer's start menu startup folder. No complaints so far this term which is far better than last year with GP pushing them out.

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



×
×
  • Create New...