Powershell showing two different version

New Contributor

Hi Everyone,

I was using my local laptop to connect to domain controller with PowerShell through Enter-Pssesion.

After connecting to it, When I am checking the power shell version for my remote computer which is my domain controller, it is showing version 1.0.0.0.0 and when I am checking it locally it is showing version 5.1.0. I am new to PowerShell. Can somebody help me to understand this

This is when I am checking PowerShell version on my dc locally.

PrimeFire_0-1650381952784.png

And this is when I am connecting this dc from a another machine through PowerShell.

PrimeFire_0-1650382195440.png

 

 

3 Replies

You should use $PSVersionTable :

[W2K22DC]: PS C:\Users\Administrator\Documents> $PSVersionTable

Name Value
---- -----
PSVersion 5.1.20348.320
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.20348.320
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

 

This matches the data if you run it locally:

 

PS C:\Users\Administrator> $PSVersionTable

Name Value
---- -----
PSVersion 5.1.20348.320
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.20348.320
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1



In a enter-pssession "get-host | Select-Object version" gives this:
Version
-------
1.0.0.0

and $host.Version gives this:

Major Minor Build Revision
----- ----- ----- --------
1 0 0 0

yes now it matches the info. thank you. is there any reason why this is not showing same version by running "get-host | select-object version" command? Just trying to understand the difference here.

Get-Host returns information about your powershell session like if you started it from the Start Menu, in a remote pssession that isn't really correct because you're starting point is the session from your computer. I think it displays a value for compatibility reasons? Please mark my answer as solution to mark it as solved.