Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

at wits end with powershell add-adgroupmember

$
0
0

Hello

I have been trying to add users to groups from a CSV for hours now using add-adgroupmember. I always get the error-

"Add-ADGroupMember : Cannot validate argument on parameter 'Identity'. The argument is null. Provide a valid value for the argument, and then try running the commandagain."

Here is the script I am using and the CSV it reads from -

Text
import-module ActiveDirectory import-csv y:\d1.csv-Delimiter ";" | Foreach-Object {add-adgroupmember -Identity $_.group -Members $_.name} 
Text
group;name "CN=example,OU=example,DC=example,DC=example,DC=example";"CN=example,OU=example,OU=example,DC=example,DC=example,DC=example" 

I have 2000 users to add to around 100 groups, maybe there is a better way? Is there something simple I am missing here?


Viewing all articles
Browse latest Browse all 15370

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>