chore: fix switch statements
This commit is contained in:
@ -66,17 +66,15 @@ foreach ($ou in @(
|
|||||||
"Servers",
|
"Servers",
|
||||||
"Workstations"
|
"Workstations"
|
||||||
)) {
|
)) {
|
||||||
switch ($ou) {
|
if ($ou -eq "LAB") {
|
||||||
"LAB" {
|
|
||||||
$path = $DefaultOUPath
|
$path = $DefaultOUPath
|
||||||
}
|
}
|
||||||
"Users","Groups","Computers" {
|
elseif ($ou -in @("Users","Groups","Computers")) {
|
||||||
$path = $LABOU
|
$path = $LABOU
|
||||||
}
|
}
|
||||||
"Servers","Workstations" {
|
else {
|
||||||
$path = "OU=Computers,$LABOU"
|
$path = "OU=Computers,$LABOU"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (-not (Get-ADOrganizationalUnit -LDAPFilter "(name=$ou)" -SearchBase $path -ErrorAction SilentlyContinue)) {
|
if (-not (Get-ADOrganizationalUnit -LDAPFilter "(name=$ou)" -SearchBase $path -ErrorAction SilentlyContinue)) {
|
||||||
New-ADOrganizationalUnit -Name $ou -Path $path -ErrorAction SilentlyContinue
|
New-ADOrganizationalUnit -Name $ou -Path $path -ErrorAction SilentlyContinue
|
||||||
|
Reference in New Issue
Block a user