As PowerShell Core begins to spread into our world, and as we start thinking about working and scripting cross-platform, it will be useful to know what type of platform you are running on. The built in $PSVersionTable is an obvious place to start. On PowerShell Core there are also some new built-in variables you can use.
ManageEngine ADManager Plus - Download Free Trial
Exclusive offer on ADManager Plus for US and UK regions. Claim now!
But these variables are not on Windows PowerShell. So I decided to add another tool to the mix – a simple function that will provide a snapshot look at version information, including what possible remoting options are available. This should be WinRM for Windows platforms and potentially SSH. The function isn't especially complicated.
Function Get-PSVersion {
<#
.Synopsis
Get a short view of PowerShell version information
.Description
Use this command to get a quick snapshot of PowerShell version information. The
Remoting property should indicate what remoting capabilities are potentially
available.
.Example
PS C:\> Get-PSVersion
Version : 5.1.16299.98
Edition : Desktop
Platform : Windows
Remoting : {WinRM}
Computername : Win10Desk
Running on a Windows 10 desktop.
.Example
PS C:\> Get-PSVersion
Version : 6.0.1
Edition : Core
Platform : Win32NT
Remoting : {WinRM, SSH}
Computername : SRV1
Running PowerShell Core on a Windows platform with SSH installed.
.Example
PS /mnt/c/scripts> get-psversion
Version : 6.0.1
Edition : Core
Platform : Unix
Remoting : {SSH}
Computername : Bovine320
PowerShell Core running in a Linux environment.
.Link
$PSVersionTable
#>
[cmdletbinding()]
Param()
$ver = $PSVersionTable.PSVersion
$edition = $PSVersionTable.PSEdition
if ($PSVersionTable.platform) {
$platform = $PSVersionTable.platform
}
else {
$platform = "Windows"
}
$remoting = @()
if (Test-Path 'WSMan:') {
$remoting+="WinRM"
}
if (Get-Command ssh -ErrorAction SilentlyContinue) {
$remoting+="SSH"
}
#use the hostname command because non-windows systems won't have
#$env:computername.
[pscustomobject]@{
Version = $ver
Edition = $edition
Platform = $platform
Remoting = $Remoting
Computername = $(hostname)
}
}
Here's what it looks like on a variety of platforms.
I might package this into my PSScriptTools module.
Have you started embracing this cross-platform world? What challenges have you encountered and how have your overcome them? I'd love to hear your stories.

When we start using powershell core, we’ll need to find replacement calls for Get-WMI calls.
Any thoughts on resources to find the most common WMI objects?
You are not the only one to wonder about this. I think long term we’ll see something like this, which you can install now. https://github.com/Microsoft/omi
Good deal.
I can’t help thinking that Richard Siddaway is working this one in one form or fashion.
It just has his name written all over it.
Thanks Jeffery!