none
Creating multiple AD Groups from CSV import in PowerShell RRS feed

  • Question

  • I'm attempting to create a powershell script to create multiple AD Groups from a csv file. The file has GroupName and Description fields and would like to create each group and add the description to it after it is created. So far, I can't even get the groups to create. I'm running into error after error no matter what I change. I referenced a closed case for script, and it made refernce to the current item in the loop, but I don't have all the terminology down to decipher where I am going wrong. PLEASE HELP! Thank in advance!

    Example:

    import-module activedirectory
    $groups = import-csv C:\AD\ADGroup.csv
    foreach ($group in $groups) {
    new-adgroup -name $groups.GroupName -GroupCategory Security -GroupScope global -Path "OU=PRINTER_TESTING,OU=Printer Groups,OU=Groups,DC=(Domainname),DC=local"
    }

    • Moved by Bill_Stewart Monday, May 7, 2018 10:00 PM This is not "scripts on demand"
    Saturday, March 3, 2018 8:13 PM

All replies