Powershell showing two different version

%3CLINGO-SUB%20id%3D%22lingo-sub-3289347%22%20slang%3D%22en-US%22%3EPowershell%20showing%20two%20different%20version%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3289347%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Everyone%2C%3C%2FP%3E%3CP%3EI%20was%20using%20my%20local%20laptop%20to%20connect%20to%20domain%20controller%20with%20PowerShell%20through%20Enter-Pssesion.%3C%2FP%3E%3CP%3EAfter%20connecting%20to%20it%2C%20When%20I%20am%20checking%20the%20power%20shell%20version%20for%20my%20remote%20computer%20which%20is%20my%20domain%20controller%2C%20it%20is%20showing%20version%201.0.0.0.0%20and%20when%20I%20am%20checking%20it%20locally%20it%20is%20showing%20version%205.1.0.%20I%20am%20new%20to%20PowerShell.%20Can%20somebody%20help%20me%20to%20understand%20this%3C%2FP%3E%3CP%3EThis%20is%20when%20I%20am%20checking%20PowerShell%20version%20on%20my%20dc%20locally.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22PrimeFire_0-1650381952784.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F365266iE4D8FBBE647F21B5%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22PrimeFire_0-1650381952784.png%22%20alt%3D%22PrimeFire_0-1650381952784.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EAnd%20this%20is%20when%20I%20am%20connecting%20this%20dc%20from%20a%20another%20machine%20through%20PowerShell.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22PrimeFire_0-1650382195440.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F365274i01B1C7257F739A26%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22PrimeFire_0-1650382195440.png%22%20alt%3D%22PrimeFire_0-1650382195440.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3289347%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EActive%20Directory%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ECompute%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EManagement%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESecurity%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3290942%22%20slang%3D%22en-US%22%3ERe%3A%20Powershell%20showing%20two%20different%20version%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3290942%22%20slang%3D%22en-US%22%3E%3CP%3EGet-Host%20returns%20information%20about%20your%20powershell%20session%20like%20if%20you%20started%20it%20from%20the%20Start%20Menu%2C%20in%20a%20remote%20pssession%20that%20isn't%20really%20correct%20because%20you're%20starting%20point%20is%20the%20session%20from%20your%20computer.%20I%20think%20it%20displays%20a%20value%20for%20compatibility%20reasons%3F%20Please%20mark%20my%20answer%20as%20solution%20to%20mark%20it%20as%20solved%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3290928%22%20slang%3D%22en-US%22%3ERe%3A%20Powershell%20showing%20two%20different%20version%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3290928%22%20slang%3D%22en-US%22%3Eyes%20now%20it%20matches%20the%20info.%20thank%20you.%20is%20there%20any%20reason%20why%20this%20is%20not%20showing%20same%20version%20by%20running%20%22get-host%20%7C%20select-object%20version%22%20command%3F%20Just%20trying%20to%20understand%20the%20difference%20here.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3289465%22%20slang%3D%22en-US%22%3ERe%3A%20Powershell%20showing%20two%20different%20version%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3289465%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20should%20use%20%24PSVersionTable%20%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%5BW2K22DC%5D%3A%20PS%20C%3A%5CUsers%5CAdministrator%5CDocuments%26gt%3B%20%24PSVersionTable%3CBR%20%2F%3E%3CBR%20%2F%3EName%20Value%3CBR%20%2F%3E----%20-----%3CBR%20%2F%3EPSVersion%205.1.20348.320%3CBR%20%2F%3EPSEdition%20Desktop%3CBR%20%2F%3EPSCompatibleVersions%20%7B1.0%2C%202.0%2C%203.0%2C%204.0...%7D%3CBR%20%2F%3EBuildVersion%2010.0.20348.320%3CBR%20%2F%3ECLRVersion%204.0.30319.42000%3CBR%20%2F%3EWSManStackVersion%203.0%3CBR%20%2F%3EPSRemotingProtocolVersion%202.3%3CBR%20%2F%3ESerializationVersion%201.1.0.1%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20matches%20the%20data%20if%20you%20run%20it%20locally%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPS%20C%3A%5CUsers%5CAdministrator%26gt%3B%20%24PSVersionTable%3C%2FP%3E%3CP%3EName%20Value%3CBR%20%2F%3E----%20-----%3CBR%20%2F%3EPSVersion%205.1.20348.320%3CBR%20%2F%3EPSEdition%20Desktop%3CBR%20%2F%3EPSCompatibleVersions%20%7B1.0%2C%202.0%2C%203.0%2C%204.0...%7D%3CBR%20%2F%3EBuildVersion%2010.0.20348.320%3CBR%20%2F%3ECLRVersion%204.0.30319.42000%3CBR%20%2F%3EWSManStackVersion%203.0%3CBR%20%2F%3EPSRemotingProtocolVersion%202.3%3CBR%20%2F%3ESerializationVersion%201.1.0.1%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3EIn%20a%20enter-pssession%20%22get-host%20%7C%20Select-Object%20version%22%20gives%20this%3A%3CBR%20%2F%3EVersion%3CBR%20%2F%3E-------%3CBR%20%2F%3E1.0.0.0%3CBR%20%2F%3E%3CBR%20%2F%3Eand%20%24host.Version%20gives%20this%3A%3CBR%20%2F%3E%3CBR%20%2F%3EMajor%20Minor%20Build%20Revision%3CBR%20%2F%3E-----%20-----%20-----%20--------%3CBR%20%2F%3E1%200%200%200%3C%2FP%3E%3C%2FLINGO-BODY%3E
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.