Powershell Novice here
Making a script to bulk add Global and Local groups. Importing info from .csv. The script will add the first group then error with “The Specified group already exists” on all other entries in file.
Script:
$filepath = Read-Host “Location of .csv file”
$CreateTheseGroups = Import-Csv $filepath
$CreateTheseGroups | New-ADGroup
.csv content
name,groupcategory,groupscope,path
GG_Executives,security,global,“ou=groups,dc=dfslab,dc=local”
GG_HumanResources,security,global,“ou=groups,dc=dfslab,dc=local”
GG_OrderDesk,security,global,“ou=groups,dc=dfslab,dc=local”
GG_SalesMarketing,security,global,“ou=groups,dc=dfslab,dc=local”
GG_IT,security,global,“ou=groups,dc=dfslab,dc=local”
GG_Shipping,security,global,“ou=groups,dc=dfslab,dc=local”
DL_Executives_RO,security,domainlocal,“ou=groups,dc=dfslab,dc=local”
DL_Executives_RW,security,domainlocal,“ou=groups,dc=dfslab,dc=local”
DL_HumanResources_RO,security,domainlocal,“ou=groups,dc=dfslab,dc=local”
DL_HumanResources_RW,security,domainlocal,“ou=groups,dc=dfslab,dc=local”
Any suggestions?
c.