Trying to do bulk create AD groups. I realize there are several scripts out there that already do this but want to learn by doing.
I cannot get past the error "Cannot validate argument on parameter 'GroupScope'"
import-module activedirectory $date = Get-Date -Format MMddyyyy $csvinput = "C:\pthtest\$date.csv" Import-Csv $csvinput foreach ($item in $csvinput) { New-ADGroup -Name "$item.Name" -GroupScope $item.GroupScope -GroupCategory $item.GroupCategory -Description "$item.Description" -ManagedBy "$item.ManagedBy" -Path "item.OUPath" -OtherAttributes @{'Info'="$item.OtherInfo"} }
csv looks like this:
Name,GroupScope,GroupCategory,Description,ManagedBy,OUPath,OtherInfo
pth-group1 Test,DomainLocal,Security,"Owner: Paul1 | p@test.com,bogususer",bogususer,"OU=Privilaged Users,DC=lapstest,DC=com",RITM1/Task1 07092015
pth-group2 Test,DomainLocal,Security,"Owner: Paul2 | p@test.com,bogususer",bogususer,"OU=Privilaged Users,DC=lapstest,DC=com",RITM2/Task2 07092015
what am I doing wrong? Any help greatly appreciated!
-Paul