Skip to content

Instantly share code, notes, and snippets.

@NickStrupat
Last active July 5, 2018 06:13
Show Gist options
  • Save NickStrupat/87d241df53169d20063a95f6547c133f to your computer and use it in GitHub Desktop.
Save NickStrupat/87d241df53169d20063a95f6547c133f to your computer and use it in GitHub Desktop.
$isDesktop = $PSEdition -eq "Desktop"
$isCore = $PSEdition -eq "Core"
if ($isDesktop -or ($isCore -and $IsWindows)) {
Write-Output Windows
}
elseif ($isCore -and $IsLinux) {
Write-Output Linux
}
elseif ($isCore -and $IsMacOS) {
Write-Output macOS
}
else {
throw "This version of PowerShell is not supported"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment