Powershell showing two different version

Copper 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

 

 

12 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.

@Harm_Veenstra 

 

I have a similar question! I have recently noticed that Microsoft Update is now automatically updating Powershell which is currently 7.4! Which seemed to work without any errors that I could notice.

  But, when I checked the version two different ways, I got Two different versions as well!

If I access Powershell through the Start Menu it shows that the version is 7.4! 

If I access Powershell by pressing the Windows Key & the X Key, Powershell recommends a pscore6 Update!

Also, please note that both 
Powershell MODES are (ADMINISTRATION). 

j80r59m_0-1675707024979.jpeg

j80r59m_4-1675707634872.jpeg

 

 
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The difference between starting pwsh.exe (Powershell 7) and powershell.exe which is version 5 (Built-In Windows version)
Why are there TWO VERSIONS?
There were a lot of versions 🙂 But basically, the one in Windows by default is version 5. Version 7 can be installed separately and updated using Windows Update. This wasn't the case before in earlier versions.
Is it necessary to have Two versions? & if so how would I Update the the version accessed using the Windows Key & the "X" Key to pscore6? Also, why doesn't Windows update do it automatically?
Hello, there are two versions because it's two very different products, which do not offer the same features nor the same support lifeycle. Also, many applications may be compatible with one version but not the other. Which is why it is usually important to keep them side-by-side.
Wouldn't recommend PowerShell Core anymore, just basic built-in 5 and 7 for me

So how do I update Powershell 5 to pscore6 as is recommended when it's first started? Also, after checking https//aka.ms/pscore6, I discovered that pscore6 is (Out of Support) as indicated on https://learn.microsoft.com/en-us/previous-versions/powershell/scripting/overview?view=powershell-7..... So is it possible to update 5 to a more recent version that is still supported? & if not how can you eliminate the upgrade recommendation in Powershell 5?

You don't need to, it's just on the system by default and you can install PowerShell 7 next to it and start that (Configure Windows Terminal to start that by default)

Don't know if you can remove the update message of version 5 though, but I don't even use it much anymore