Add Multiple Users To Group Policy Filtering Using PowerShell

In this blog post, I’ll show you how to add multiple users to a Group Policy Object using PowerShell and a CSV file.

One of the Issues with adding users to a Group Policy Objects Is that the Add menu only allowing to add one user at a time or groups.

In my case, the customer didn’t want to use groups and wanted to use users Instead.

The solution was to use Windows PowerShell and a CSV file with all the users In.

Requirements

Because my Group Policy Is not using the Authenticated Users group, I’ll need to add the Enterprise Domain Controllers Group to the Delegation Tab Inside the GPO otherwise the policy will not apply.

CSV FILE

Below, You can see the .CSV file structure (very simple), Create it and save it.

PowerShell Code

The PowerShell script below will use the Set-GPPermission cmdlet to add Users to the GPO

import-csv C:\CSV\users.csv | foreach{set-GPPermission -Name "outlook anywhere" -TargetName $_.samaccountname -PermissionLevel GpoApply -TargetType User -Verbose }

AFTER

Once completed, The GPO will look like the screenshot below.

I can also check which users the policy applying to using the cmdlet below:

Get-GPPermission -name “Outlook Anywhere” -all


Posted

in

by

Comments

One response to “Add Multiple Users To Group Policy Filtering Using PowerShell”

  1. Miles Boyce Avatar
    Miles Boyce

    How would I do this for computers?