Mapping printers based on Active Directory group membership using Windows PowerShell

While researching for a logon script setup for mapping network printers using Windows PowerShell, I thought of using the Windows native tool printui.dll for the actual printer mappings.
However, I wasnt quite sure how to check for a users group membership in Active Directory. This sure can be accomplished with a tool like Quests PowerShell Commands for Active Directory. However, installing this on every domain computer wasnt an option.
Then I found Andy Grogans PowerShell function for determining AD group membership.

Based on this function, and the printui.dll the task was easy to accomplish. Ive published a sample script to PoshCode.org, available from here.

You may also want to check out “PrintUI.DLL User’s Guide and Reference“.

Tested with Windows PowerShell v 1.0/2.0 and Windows XP/Vista/7.

As an alternative, you may also want to check out this blog post on mapping printers using Group Policy.

One thought on “Mapping printers based on Active Directory group membership using Windows PowerShell

  1. Pingback: GPO – Ajouter des imprimantes sur des groupes utilisateurs | Le shell à la ligne...