Saw a question about testing the operating system and decided that the easiest way was to use the Version property from Win32_OperatingSystem. By easiest I mean least typing and string testing.
$os = Get-WmiObject -Class Win32_OperatingSystem
switch… Read the full text.