In PowerShell, it has different ways to check PowerShell version on your local computer or psversion on remote computer. $PSVersionTable automatic variable in PowerShell get PowerShell version details.
$PSVersionTable
is an automatic variable in PowerShell is read only hash table that returns PowerShell Version (PSVersion) information and PSEdition information either Core or Desktop.

In PowerShell, it has different ways to get PowerShell version like using Get-Host, $Host, $PSVersionTable you can get PowerShell version.
PSVersionTable – Check PowerShell Version
You can use $PSVersionTable
automatic variable in PowerShell to get running PowerShell version on your local computer.
Run below command to check PowerShell version
$PSVersionTable.PSVersion
Above PSVersionTable variable returns PSVersion as below
PS C:\> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 1 18362 1474
PS C:\>
PSVersionTable gets Major version, minor version , Build and Revision information about PowerShell.
Check PowerShell Version remotely using PSVersionTable
You can use $PSVersionTable automatic variable to check PowerShell version on remote computer, use below command to get PSVersion
Invoke-Command -ComputerName incorp-eu-101 -ScriptBlock {$PSVersionTable.PSVersion}
In the above PowerShell script, it uses Invoke-Command
cmdlet to run command on remote computer specified by computer name and using PSVersionTable.PSVersion
, it get PowerShell version on remote computer.
Check PowerShell Version using Get-Host
You can use Get-Host cmdlet in PowerShell gets host program that is hosting Windows PowerShell. Using Get-Host cmdlet you can check PowerShell version on local computer and remote computer.
When you run Get-Host
cmdlet in PowerShell console, it returns host information which contains PowerShell version, Current Culture, CurrentUICulture etc..
Get-Host
Above Get-Host in PowerShell console, gets PowerShell version and other information as below

If you try to use Get-Host cmdlet to get remote computer PowerShell version, it may not get correct version details, hence avoid using it and use $PSVersionTable variable to get PowerShell version.
Cool Tip: How to get list of PowerShell modules!
Get PowerShell Version using $Host
You can use $Host automatic variable in PowerShell to get PowerShell version, use below command
$Host
Above $Host
automatic variable in PowerShell returns the same information about PowerShell as Get-Host
cmdlet does.
Output of above command as below
PS C:\> $Host
Name : ConsoleHost
Version : 5.1.18362.1474
InstanceId : 257ef135-307f-4a09-9ca7-d9543c96129b
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-IN
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
Cool Tip: Do you know which are approved verbs in PowerShell!
Conclusion
I hope above article to check PowerShell version on local computer and PSVersion on remote computer helpful to you.
As an administrator, we always need to make sure system having update PowerShell version on each of system in domain.
$PSVersionTable
automatic variable in PowerShell is best way to get PowerShell version of local computer as well using Invoke-Command
cmdlet you can get PowerShell version remotely of other computers in the domain.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on ShellGeek home page.