Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

import users from database into active directory group

$
0
0

Trying to write powershell script to populate a group of users on a specific databse to an Active Directory group.  User in the database are in a child domain, the parent domain contains the group.

 

I have:

Import-Module ActiveDirectory

$ADGroup = "CN=testgroup,DC=test,DC=com"

$Users = get-mailbox -database server\database -IgnoreDefaultScope | select samaccountname

Add-ADGroupMember -Identity $ADGroup -Members $Users


Viewing all articles
Browse latest Browse all 6937

Trending Articles