Find All Users in Domain and Add them to Group

Posted by admin | Posted in Technical | Posted on 22-08-2013-05-2008

0

Today I need to be able to to grab all users in the domain and add them to a group. I found a couple of examples that would get me part of the way but not finish the job.  After going around and piecing some others codes together here is what I came up with.

$user = Get-ADUser -SearchBase “DC=<DOMAIN>,DC=<TOPLEVELDOMAIN>” -Filter *;

$group = Get-ADGroup “CN=<GROUPNAME>,OU=<LOCATION OF GROUP>,DC=<DOMAIN>,DC=<TOPLEVELDOMAIN>”;

Add-ADGroupMember $group –Member $user

Write a comment

This blog is kept spam free by WP-SpamFree.