hey all,
I'm trying to create some AD groups en mass and I got the names in a CSV file that has been imported successfully, but my ForEach command isn't creating the groups, and it's not generating an error. Not sure what's going on there, but here is my code:
Import-Module ActiveDirectory $groups = Import-Csv C:\Users\myuser\Desktop\groups.csv ForEach ($group in $group) {New-ADGroup -Name $group.name -Path “OU=Groups,OU=Department,DC=domain,DC=com” -GroupCategory Security -GroupScope Universal }
I haven't tried taking the last bits off, but I think they need to be defined. Any thoughts help!
Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.