Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Script to set default printers

- - - - -

  • Please log in to reply
2 replies to this topic


  • Member
  • 1 posts
  • Joined 19-November 12
  • OS:Windows 7 x64
  • Country: Country Flag
I'm new to VB scripts, and having issues wrapping my head around how to do this. I have a simple script written to put on machine by machine that will set default printer, but looking to write one to apply through Domain policy to cover all. We have some computers installed in cars that have local USB connections to Brother Pocket Jet printers (some Brother Pocket Jet 3 Plus and some Brother PJ-623). I’m trying to write a script that on can be applied to user OU from AD that when the user logs in the script will look to see if one of the Brother printers are installed, if so make that the default printer. If the script finds that there is not a Brother printer I want it to connect to a network share printer and set the network share as the default. It would be nice to set the network share as a printer to for all computers, just set the default depending on the Brother printers.
Thanks in advanced for any and all help.

Here is the only thing I have now.

Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\Server\printer"
WshNetwork.SetDefaultPrinter "\\Server\printer"

How to remove advertisement from MSFN



    MSFN Master

  • Super Moderator
  • 2,244 posts
  • Joined 02-August 03
  • OS:none specified
  • Country: Country Flag
Here is a Link to some WMI Printer Scripts
Here is a Link to the WMI Printer Class




    Certified Geek

  • Member
  • 44 posts
  • Joined 06-May 03
What Server OS are you using on your domain? If you are using Windows Server 2008 or higher, you may be able to do this without scripts at all, and simply use Group Policy preferences. See this article -> http://blogs.technet...lt-printer.aspx

You'll note that you can share a printer, update a shared printer to be default and also update a shared printer to be default ONLY if there is no local printer present, which seems to cover what you need. If you want to target specific computers, users, OU's, security groups etc, you can use Item Level targeting from the Common tab shown in the article I mentioned. (more info here -> http://technet.micro...y/cc733022.aspx)

I'm happy to provide assistance on this as I use this feature across the 4 schools networks I manage.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users