Advertisement
Guest User

Untitled

a guest
Oct 7th, 2015
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Import-Module "C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1"
  2. $listOfApp = ('App1','App2')
  3. $ou = "OU=AppGroups,DC=Domain,DC=TLD"
  4.  
  5. Foreach ($app in $listOfApp)
  6. {
  7.     $GroupName = "App" + $app + "Users"    
  8.     New-AdGroup -Name $GroupName -Path $ou -GroupCategory Security -GroupScope Global -Description "Members of this group has access to $app"
  9.     New-CMUserCollection -Name $GroupName -RefreshType ConstantUpdate -LimitingCollectionName "All User Groups" -Comment "Members of this group has access to $app"
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement