Add files via upload
This commit is contained in:
parent
55884794ef
commit
4e2007e54a
55
Createnewgroups.ps1
Normal file
55
Createnewgroups.ps1
Normal file
@ -0,0 +1,55 @@
|
||||
$department = "Art and Design"
|
||||
$name = $department.Split(" ")
|
||||
$groupName= "grp"
|
||||
foreach($word in $name){
|
||||
|
||||
if($word -ne "and"){
|
||||
|
||||
$groupName = $groupName + "-" + ($word).ToLower()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$departments = (Import-Csv -Path "C:\Scripts\Data\Departments.csv").Department
|
||||
|
||||
$path = "OU=Groups,OU=ITLifeSkills,DC=hq,DC=itlifeskills,DC=local"
|
||||
|
||||
foreach ($department in $departments){
|
||||
|
||||
$name = $department.Split(" ")
|
||||
$groupName= "grp"
|
||||
foreach($word in $name){
|
||||
|
||||
if($word -ne "and"){
|
||||
|
||||
$groupName = $groupName + "-" + ($word).ToLower()
|
||||
}
|
||||
}
|
||||
|
||||
New-ADGroup -Name $groupName -SamAccountName $groupName -GroupCategory Security -GroupScope Global -DisplayName $groupName -Path $path -Description $department
|
||||
}
|
||||
|
||||
|
||||
|
||||
$projects = (Import-Csv -Path "C:\Scripts\Data\Projects.csv").Project
|
||||
|
||||
$path = "OU=Groups,OU=ITLifeSkills,DC=hq,DC=itlifeskills,DC=local"
|
||||
|
||||
foreach ($project in $projects){
|
||||
|
||||
$name = $project.Split(" ")
|
||||
$groupName= "grp"
|
||||
foreach($word in $name){
|
||||
|
||||
if($word -ne "and"){
|
||||
|
||||
$groupName = $groupName + "-" + ($word).ToLower()
|
||||
}
|
||||
}
|
||||
|
||||
New-ADGroup -Name $groupName -SamAccountName $groupName -GroupCategory Security -GroupScope Global -DisplayName $groupName -Path $path -Description $project
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user