cls add-PSSnapin quest activeroles admanagement faculties avtf fla mtf

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
cls
#add-PSSnapin quest.activeroles.admanagement
$faculties = "avtf", "fla", "mtf", "fpmi", "ref", "fma", "fen", "zfen", "ftf", "fb", "fgo", "uf", "zf", "mag"
foreach($faculty in $faculties) {
#New-QADGroup -Name "camp-$faculty-admins" -ParentContainer "OU=Groups,OU=Campaign,OU=University,DC=corp,DC=nstu,DC=ru" -GroupType 'Security'
for($i=1; $i -le 5; $i++) {
New-QADComputer -Name "camp-$faculty-0$i" -SamAccountName "camp-$faculty-0$i" -ParentContainer "OU=Computers,OU=Campaign,OU=University,DC=corp,DC=nstu,DC=ru" -Location $faculty -ManagedBy (Get-QADGroup "camp-$faculty-admins")
}
}