Add files via upload

This commit is contained in:
itlifeskills 2024-09-22 11:52:51 -05:00 committed by GitHub
parent 55884794ef
commit 4e2007e54a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

55
Createnewgroups.ps1 Normal file
View 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
}