From 66ddb7365b10e51ce52bc79382e3279fbda94ae3 Mon Sep 17 00:00:00 2001 From: Matthew McKinnon Date: Thu, 31 Jul 2025 10:42:08 +1000 Subject: [PATCH] chore: fix switch statements --- Setup-AD-PostReboot.ps1 | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Setup-AD-PostReboot.ps1 b/Setup-AD-PostReboot.ps1 index a64218f..a5f9f24 100644 --- a/Setup-AD-PostReboot.ps1 +++ b/Setup-AD-PostReboot.ps1 @@ -66,16 +66,14 @@ foreach ($ou in @( "Servers", "Workstations" )) { - switch ($ou) { - "LAB" { - $path = $DefaultOUPath - } - "Users","Groups","Computers" { - $path = $LABOU - } - "Servers","Workstations" { - $path = "OU=Computers,$LABOU" - } + if ($ou -eq "LAB") { + $path = $DefaultOUPath + } + elseif ($ou -in @("Users","Groups","Computers")) { + $path = $LABOU + } + else { + $path = "OU=Computers,$LABOU" } if (-not (Get-ADOrganizationalUnit -LDAPFilter "(name=$ou)" -SearchBase $path -ErrorAction SilentlyContinue)) {