I ran into a bug in the 3rd and 4th version of powershell (in the 2nd version everything works)
$newvar=if (0) {55}; switch($newvar) { "r"{1}; default{2}} Adding else makes the code workable (on version 3.4)
$newvar=if (0) {55} else {$null}; switch($newvar) { "r"{1}; default{2}} In the shortened form, switch($(if (0) {55})) { default{2}} does not work on any version. But if you add something else it will work everywhere:
switch($(if (0) {55} else {$null})) { default{2}} Can someone tell me where to find the full list of powershell bugs / features?