Definição
Condições em scripts. switch compara um valor com várias opções, inclusive com regex e curingas.
Exemplos
1. if / elseif / else
if ($amount -gt 1000) { $tier = 'high' }
elseif ($amount -gt 100) { $tier = 'medium' }
else { $tier = 'low' }2. switch
switch ($command) {
'load' { Invoke-Load }
'export' { Invoke-Export }
default { Write-Host 'unknown command' }
}3. Inline (ternário no PowerShell 7+)
$mode = $fullRefresh ? 'overwrite' : 'append'