From 04e8ae1197f03abecaaa5ca474189a500af41106 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 23 Mar 2024 21:51:19 +0100 Subject: [PATCH] Refactor switch statements --- scripts/Windows/OS/Install.ps1 | 2 +- scripts/Windows/OS/User/Add.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/Windows/OS/Install.ps1 b/scripts/Windows/OS/Install.ps1 index 207bb3bc..19e947ba 100644 --- a/scripts/Windows/OS/Install.ps1 +++ b/scripts/Windows/OS/Install.ps1 @@ -29,7 +29,7 @@ function Start-WindowsInstallation([Context] $context) { while (-not $finished) { switch ($context.GetStage()) { - { $_ -in $null,$initialConfigStage } { + { (-not $_) -or ($_ -eq $initialConfigStage) } { $context.SetStage($initialConfigStage); if ((Get-Command Initialize-Configuration -ErrorAction SilentlyContinue)) { diff --git a/scripts/Windows/OS/User/Add.ps1 b/scripts/Windows/OS/User/Add.ps1 index 6a4deb0c..ab93873d 100644 --- a/scripts/Windows/OS/User/Add.ps1 +++ b/scripts/Windows/OS/User/Add.ps1 @@ -25,7 +25,7 @@ function New-PersonalUser([Context] $context, [string] $userName) } switch (Get-UserStage) { - { $_ -in $null,$creationStage } { + { (-not $_) -or ($_ -eq $creationStage) } { Set-UserStage $creationStage; if (-not (Get-LocalUser $userName -ErrorAction SilentlyContinue)) {