- Changed type SCCM Rockstar 3 hours 10 minutes ago mistake
'Hi,
at first I would request you to change this thread Type from "Discussion" to "Question" so that you can mark as answer once you get the solution.
Now , here is your solution ...........
New-ADGroup -name MasterGroup -Description "This is master Group" -GroupScope Global -GroupCategory Security $masterG=Get-ADGroup "masterGroup" $gName="Group" # if you want other naming convention , change here $num=Read-Host "Number of Groups you want to create " for($i=1;$i -le $num; $i++) { new-adgroup -Name "$gname $i" -Description " This group is member of Master Group" -GroupCategory Security -GroupScope Global Add-ADGroupMember -Identity $masterG -Members "$gname $i" }
This will create a Master group named 'MasterGroup' and then will create the group in the naming conventions like 'Group 1' , "Group 2 " ........ and so on based on the number of your input you want to create group and then finally add these group to MasterGroup.
Hope , it helps you.
HI tarique
thanks for your solution ,i will try this and let you know,
i have a doubt, if we have to fill same discribtion on all security groups then what modification require in the script.
Hi ,
we have included the description as well , in the -Descripton parameter => replace your own descripton here
One more thing :
Don't forget to import ActiveDirectory module while you run this script in PowerShell.
Import-Module ActiveDirectory
new-adgroup -Name "$gname $i" -Description " This group is member of Master Group" -GroupCategory Security -GroupScope Global