Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Group Policies / Deploying Printers to Domain Users and Computers with GPO

April 19, 2023 Active DirectoryGroup PoliciesWindows 10Windows 11Windows Server 2019

Deploying Printers to Domain Users and Computers with GPO

You can use Group Policies (GPOs) to install and connect shared printers to specific users, computers, and groups in an Active Directory domain. In this article, we’ll look at how to automatically connect a shared printer for a domain user when they log on to a Windows computer.

Consider the following configuration: there are 3 departments in the organization. Users of each department must print documents on their own color network printer. As an administrator, you have to configure the automatic deployment of shared printers for users depending on their department.

Contents:
  • Deploying Printers to Domain Users via Group Policy
  • Allow Non-Admin Users to Install Printer Drivers via GPO

Deploying Printers to Domain Users via Group Policy

Create three new security groups in AD (SharedPrinter_Sales, SharedPrinter_IT, SharedPrinter _Managers) and add the department users to them (you can automatically add users to domain groups by following the article “Creating a Dynamic Group in Active Directory”). You can create groups in the Active Directory Users and Computers console (dsa.msc, ADUC) or using the New-ADGroup cmdlet:

New-ADGroup "SharedPrinter_Sales" -path 'OU=Groups,OU=Paris,DC=woshub,DC=com' -GroupScope Global –PassThru

  1. Run the domain Group Policy editor (GPMC.msc), create a new policy print_AutoConnect and link it to the OU with the target users; How to Install Drivers and Deploy Printers to Domain Users / Computers with Group Policy?
    If you have a small number of shared network printers in your domain (up to 30-50), you can configure them using a single GPO. If you have a complex domain structure with AD sites, Organizational Units (OUs) and delegate some AD administration tasks to branch administrators, it is better to create multiple printer deployment policies. For example, one policy for each AD site or Organizational Unit (OU).
  2. Switch to the policy-editing mode and expand the User Configuration -> Preferences -> Control Panel Setting -> Printers. Create a new policy item by selecting New -> Shared Printer; 
    If you want to connect a network printer by its IP address (directly, without a print server), select TCP/IP Printer.  
    GPO to connect shared printer device
  3. Specify Update as an action. In the Shared Path field, enter the UNC address of your shared printer, for example, \\srv-par-print\hpsales (in my case all printers are connected to the print server \\srv-par-print). Here you can specify whether to set this printer as the default printer; connect shared printer from print-server via GPO
    You can publish your shared printers in Active Directory. To do this, enable the List in the Directory option in the printer settings on the Sharing tab. list shared printer in active directory  In this case, you can find your printer by searching AD (no need to enter the printer name manually). Just click the three dots button when you select your printer, click the Find now button, and select the dots printer name from the list. search for shared printers in active directory
  4. Go to the Common tab and specify that the printer must be connected in the current user context (Run in logged-on user’s security context). Also, check the Item-level targeting option and click Targeting;
  5. Using GPP targeting, you need to specify this printer connection policy should only apply to SharedPrinter_Sales group members. To do it, go to New Item -> Security Group and enter SharedPrinter_Sales as a group name; printer deployment targeting: specify AD security group to deploy printers
    Please note that this restriction doesn’t prevent a domain user from manually connecting this printer using File Explorer. To restrict access to the printer, you will have to change the printer security permissions on the print server and allow printing only for specific groups.  
  6. Create network printer installation options for other user groups in the same way. connect different printer to different security groups
Also there is an old GPO section to configure printers: Computer Configuration -> Policies -> Windows Settings -> Deployed Printers. But this method of installing printers for users is less flexible than the one using GPP described above.  

Check that shared network printers are now automatically connected when users log in to domain-joined Windows computers.

shared printer connected to user session via gpo

When using this Group Policy, new printers will only be installed for users if the appropriate print driver is already installed on their computers (drivers must be manually installed first or integrated directly into the Windows image).

If no driver is installed for this printer, then the printer assigned via GPO will not be added to the user. In this case, an event with Event ID 4096 will appear in the Event Log -> Application log:

Source: Group Policy PrintersThe user 'HPLaserJet400' preference item in the 'prnt_AutoConnect}' Group Policy Object did not apply because it failed with error code '0x800702e4 The requested operation requires elevation.' This error was suppressed.

printer install error: 0x800702e4 requires elevation

The fact is that now Windows users without administrator privileges cannot install a printer driver, even though the Point and Print Restriction policy is set.

Allow Non-Admin Users to Install Printer Drivers via GPO

In 2021, a critical vulnerability was discovered in the print spooler service, to fix which Microsoft changed the default behavior of Windows when installing print drivers (PrintNightmare CVE-2021-34527). Now users without administrator permissions cannot install printer drivers (KB5005033), including using the Point and Print Restriction GPO option. Windows drivers (signed and unsigned) should only be installed by administrators.

However, there is a workaround that will allow non-admin users to install the printer drivers. To do this, you need to change your GPO.

  1. Go to the following GPO section Computer Configuration -> Windows Settings -> Security Settings -> Local Policies -> Security Options. Enable the option Devices: Prevent users from installing printer drivers;
  2. Now go to Computer Configuration -> Policies -> Administrative Templates -> System -> Driver Installation. Add printer device classes GUID in the Allow non-administrators to install drivers for these device setup classes parameter {4658ee7e-f050-11d1-b6bd-00c04fa372a7} and {4d36e979-e325-11ce-bfc1-08002be10318}. This will only allow the installation of print drivers;
  3. Navigate to Computer Configuration -> Policy -> Administrative Templates ->  Printers. Enable the policy Point and Print Restriction. Here you need to specify a list of your print servers (Users can only point and print to these servers) from which you are allowed to install print drivers. Select Don’t show warning or elevation prompt for the two remaining options;Configure Point and Print Restriction policy to install print drivers
  4. Add a list of your trusted print servers to the parameter Package Point and print — Approved servers;configuring the policy: Package Point and Print – Approved server
  5. (Now the most important point!!). To allow the installation of printer drivers without administrator privileges (for non-admin users), you need to temporarily change the value of the RestrictDriverInstallationToAdministrators registry parameter to 0.

On a standalone computer, you can change this registry parameter with the command:

reg add "HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows NT\Printers\PointAndPrint" /v RestrictDriverInstallationToAdministrators /t REG_DWORD /d 0 /f

In order to change this registry parameter on a user’s computers via GPO, you need to create a new Group Policy Preferences rule under Computer Configuration -> Preferences -> Windows Settings -> Registry. Create a registry parameter with the following settings:

Action: Replace
Hive: HKEY_LOCAL_MACHINE
Key path: Software\Policies\Microsoft\Windows NT\Printers\PointAndPrint
Value name: RestrictDriverInstallationToAdministrators
Type: REG_DWORD
Value: 0

RestrictDriverInstallationToAdministrators registry item to bypass PrintNightmare fix

The new administrative templates (ADMX) files from the Microsoft Security Baseline contain a separate GPO option for this registry parameter. It is called “Restrict printer driver installation to administrators” (Computer Configuration -> Policy -> Administrative Templates -> Printers).gpoRestrict printer driver installation to administrators

Go to the Common tab and enable the option Remove this item when it is no longer applied.

gpo: remove item when it is no longer applied

Now update the GPO settings on the clients (re-login or run the gpupdate /force command) and check that the drivers from the print servers are now installed automatically. MsiInstaller events should appear in the Application log:

EventID 1040
Beginning a Windows Installer transaction: C:\Windows\system32\spool\DRIVERS\x64\3\CIOUM64.MSI. Client Process Id: 7240.

eventid 1040 msiinstaller install printer driver

Such a GPO will allow any non-admin user to install shared printers and drivers from specified print servers without prompting for elevation or any notifications.

But the RestrictDriverInstallationToAdministrators parameter makes your Windows vulnerable to the PrintNightmare exploit. Therefore, we recommend returning its value to 1 immediately after installing the printers.

https://support.microsoft.com/en-us/topic/kb5005652-manage-new-point-and-print-default-driver-installation-behavior-cve-2021-34481-873642bf-2634-49c5-a23b-6d8e9a302872

You can run the logon script (only once) on the first logon for each user that sets the RestrictDriverInstallationToAdministrators = 1. The next time this script is run, it checks the value of RestrictDriverInstallationToAdministrators and, if it is 1, changes it to 0. This way, all printers assigned to the user via the GPO will be installed on the first login, and the RestrictDriverInstallationToAdministrators value will be automatically changed to a secure state.

Note that only signed printer drivers (Package-aware v3 print drivers) can be installed this way (with the Packaged=True value in the Drivers section of the Print Management console – printmanagement.msc). See the article Unable to install non-package-aware print drivers.

packaged aware v3 print drivers in windows

If you try to install a printer with an unsigned driver via GPO, it won’t be deployed despite the RestrictDriverInstallationToAdministrators parameter:

The user 'HP2500' preference item in the 'prnt_AutoConnect {GUID}' Group Policy Object did not apply because it failed with error code '0x80070bcb The specified printer driver was not found on the system and needs to be downloaded.' This error was suppressed.
Previously, to install and connect users’ printers I had to use .bat and PowerShell scripts. These scripts need to be run as Startup GPO scripts, and Group Policy Filtering can be used to target the printer installation. However, it is much easier to use GPP to deploy printers.

7 comments
7
Facebook Twitter Google + Pinterest
previous post
Installing Remote Desktop HTML5 Web Client on Windows Server RDS
next post
How to Reset Network Settings in Windows

Related Reading

Zabbix: How to Get Data from PowerShell Scripts

October 27, 2023

Tracking Printer Usage with Windows Event Viewer Logs

October 19, 2023

How to Use Ansible to Manage Windows Machines

September 25, 2023

Installing Language Pack in Windows 10/11 with PowerShell

September 15, 2023

How to View and Change BIOS (UEFI) Settings...

September 13, 2023

7 comments

Roman Kyrianov April 23, 2020 - 12:23 pm

Hi,
thank you for your manual.
One thing I would like to correct:
Under User Configuration -> Policy -> Administrative Templates -> Control Panel -> Printers -> exists no point Printer -> Point and Print Restriction
It exists only under Computer Configuration.

Reply
tek November 15, 2022 - 11:19 am

Computer Configuration -> Policy -> Administrative Templates -> Printers -> Point and Print Restriction This is correct path.

Reply
admin November 16, 2022 - 8:31 am

Fixed, thanks!

Reply
[21H2] Connecting to network printers in logon script? November 24, 2022 - 3:54 pm

[…] Why can't you just use GPO?…. Deploying Printers to Domain Users and Computers with GPO | Windows OS Hub […]

Reply
ESG June 1, 2023 - 9:55 am

It hasn’t worked, I keep getting the error “Group Policy Object did not apply because it failed with error code ‘0x800702e4′”

Reply
None July 20, 2023 - 8:44 pm

As always, great stuff. Thanks m8

Reply
dk September 25, 2023 - 2:27 pm

Thanks! double check the unc printer name:
Group Policy Object did not apply because it failed with error code ‘0x80070709 The printer name is invalid.’ This error was suppressed

Reply

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Zabbix: How to Get Data from PowerShell Scripts

    October 27, 2023
  • Tracking Printer Usage with Windows Event Viewer Logs

    October 19, 2023
  • PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

    October 15, 2023
  • Reset Root Password in VMware ESXi

    October 12, 2023
  • How to Query and Change Teams User Presence Status with PowerShell

    October 8, 2023
  • How to Increase Size of Disk Partition in Ubuntu

    October 5, 2023
  • How to Use Ansible to Manage Windows Machines

    September 25, 2023
  • Installing Language Pack in Windows 10/11 with PowerShell

    September 15, 2023
  • Configure Email Forwarding for Mailbox on Exchange Server/Microsoft 365

    September 14, 2023
  • How to View and Change BIOS (UEFI) Settings with PowerShell

    September 13, 2023

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Configure Google Chrome Settings with Group Policy
  • Get-ADUser: Find Active Directory User Info with PowerShell
  • Allow Non-admin Users RDP Access to Windows Server
  • How to Find the Source of Account Lockouts in Active Directory
  • How to Disable or Enable USB Drives in Windows using Group Policy
  • Get-ADComputer: Find Computer Properties in Active Directory with PowerShell
  • Configuring Proxy Settings on Windows Using Group Policy Preferences
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top