Network Printers Assigned by Computer via a script run by a GPO
September 23rd, 2006To assign a network printer via GPO you can either assign them to the user or to a computer. Scripting Printer installation for a user is fairly simple and straight forward.
-
Create a script to map the appropriate printer:
Option Explicit
Dim objNetworkSet ObjNetwork=CreateObject("Wscript.Network")
objNetwork.addWindowsPrinterConnection"\\serveripaddress\printername"
Wscript.Quit - In windows explorer copy the file. Open GPMC.
-
Create a GPO for the appropriate user OU. Edit the settings and navigate to:
User Configuration->Windows Settings->Scripts->Logon - Add a script, just type the name of the file, not the path.
- Click the Show Files button and Paste your script into the Folder that opens.
If you login as a user within this OU you should now see the printer is available to you.
To assign a printer by computer, such as in a lab situation where anyone who logs in should have access to the printer follow the previous steps, but make the GPO on the OU that contains the computers. Note that you are making a GPO that targets users, but applying it to computers. To make this work you need to add one more setting to your GPO.
- Navigate to:
Computer Configuration->Administrative Templates->System->Group Policy - Set the value of “User Group Policy loopback processing mode” to Enabled and use the “Merge” option.
If you now login to a computer in the OU that you just applied the policy to you will have access to that printer, but if you move to a computer outside the OU it won’t be available to you.
The Group Policy Loopback processing mode of merge essentially means that policies should be applied to the computer at startup, the user at login, and then the user section of the computer policy afterward (still at login.)
Here is a relatively concise set of information on GPO loopback.