Group PolicyMicrosoftWindows 7Windows 8Windows XP

Set Default Printer | vbs Script Group Policy

We have policys in place that are installing all printers at each school to all machines. We then change the security settings to block students from printing to the staff printers etc. The only problem we’ve ran into is being unable to set the default printer when you deploy the printers via computer configuration instead of user configurations.  Below is the script we use to set the default.

  • Copy the code below into notepad and save it as a .vbs or download here.
  • Be sure to change save as type in notepad to all files.
  • Change PME-PRN-Lab with the name of the printer you want set as default.

Notes: You can leave the computer name blank along with the server if your not using one. 

strComputer = "" 'target pc name use for individual machines
strPrintServerName = "" 'print server name if necessary
strPrintQueue = "PME-PRN-Lab" 'print queue name
strPrinter = "\\" & strPrintServerName & "\" & strPrintQueue 'creates UNC to printer
Set oShell = CreateObject("Wscript.Shell")
Cmd = "%COMSPEC% /c rundll32 printui.dll,PrintUIEntry /y /c\\" & strComputer &" /n" & strPrinter
oShell.Run Cmd,0,1

How To Setup

  1. Create Your Group Policy
  2. Edit the Policy Settings and add the .vbs script you created earlier to User Configuration > Windows Settings > Scripts (Logon/Logoff)
  3. Next browse to Computer Configuration > Administrative Templates > System > Group Policy > User Group Policy loopback processing mode – double click
  4. Enabled it and change the mode to merge.
  5. Your Done! Go out and test it!

Below is a quick video on a tutorial. Sorry I didn’t have a mic at work but if you have any questions let me know below!

Tags
Show More

Cory Fiala

Technology and outdoor enthusiast. Anything from desktops to servers with a side of mountain biking and skiing. Life is good!

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Close
Close