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

Add list of users from file by UPN and add to Global Group

$
0
0
$ADS_PROPERTY_APPEND = 3
$userOU = [ADSI] "LDAP://cn=myUser,ou=Users,dc=contoso,dc=com"
$groupOU = [ADSI] "LDAP://cn=myGroup,ou=Users,dc=contoso,dc=com"$groupOU.putEx($ADS_PROPERTY_APPEND, "member", @($userOU.distinguishedname))
$groupOU.SetInfo()


I'm new with Powershell so bear with me.... I found this script and need to modify this script to take a list of users
take a TXT file with a list emails "User Principal Name" and add these users to a global group.

I have a list of 15,000 users so this is why I'm trying to use ADSI. I also need to factor in
if the users exists in the global group already, skip the user.

Viewing all articles
Browse latest Browse all 6937

Latest Images

Trending Articles



Latest Images