top of page
PowerShell Switch
# When you need to have a multitude of conditions and a lot
# cleaner than lots of If statements.
$MySwitchData=1
switch ($MySwitchData) {
0 {$out = "Unlicensed"}
1 {$out = "Licensed"}
2 {$out = "Out-Of-Box Grace Period"}
3 {$out = "Out-Of-Tolerance Grace Period"}
4 {$out = "Non-Genuine Grace Period"}
5 {$out = "Notification"}
6 {$out = "Extended Grace"}
default {$out = "Unknown value"}
}
Write-Output $out

bottom of page