Jump to content

Script to set default printers


Recommended Posts

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"

Link to comment
Share on other sites


  • 3 months later...

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.com/b/grouppolicy/archive/2009/06/24/gp-preferences-set-a-default-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.microsoft.com/en-au/library/cc733022.aspx)

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

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
  • Recently Browsing   0 members

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