Skip to content

Instantly share code, notes, and snippets.

@Jaykul
Created December 19, 2016 05:22
Show Gist options
  • Save Jaykul/596b49614d202f844a0ada2352e336c9 to your computer and use it in GitHub Desktop.
Save Jaykul/596b49614d202f844a0ada2352e336c9 to your computer and use it in GitHub Desktop.
All those informative variables in PowerShell 6.0
$script:IsWindows = (-not (Get-Variable -Name IsWindows -ErrorAction Ignore)) -or $IsWindows
$script:IsLinux = (Get-Variable -Name IsLinux -ErrorAction Ignore) -and $IsLinux
$script:IsOSX = (Get-Variable -Name IsOSX -ErrorAction Ignore) -and $IsOSX
$script:IsCoreCLR = (Get-Variable -Name IsCoreCLR -ErrorAction Ignore) -and $IsCoreCLR
$script:IsNanoServer = $null -ne ('System.Runtime.Loader.AssemblyLoadContext' -as [Type])
$script:IsInbox = $PSHOME.EndsWith('\WindowsPowerShell\v1.0', [System.StringComparison]::OrdinalIgnoreCase)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment