question

RogerRoger-2394 avatar image
0 Votes"
RogerRoger-2394 asked azure-cxp-api edited

AD Groups creation

Hi All

I have 50 groups to be created in AD under the OU OU=Groups,DC=contoso,DC=com
i have csv file in the below format, how can i import this csv file and create AD group in the OU, OU=Groups,DC=contoso,DC=com. Experts guide me
95646-groups.jpg


windows-serverwindows-server-2019windows-server-2016windows-server-2012
groups.jpg (20.8 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

IanXue-MSFT avatar image
0 Votes"
IanXue-MSFT answered

Hi,

You can try some PowerShell script like this

 $file = "C:\temp\groups.csv" 
 $OU = "OU=Groups,DC=contoso,DC=com"
 Import-Csv -Path $file | ForEach-Object {
     New-ADGroup -GroupScope Global -Path $OU -Name $_."Group name" -Description $_.Description -OtherAttributes @{mail=$_.email}
 }

Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.