Powershell: PSCore6 - How about including the platform architecture in the $PSVersionTable?

Created on 9 May 2018  路  6Comments  路  Source: PowerShell/PowerShell


Due to the fact that there still are people using either 64 or 32bit processor architectures. I think it won't hurt to provide this information in the $PSVersionTable.

It could be nice to include the *$env:PROCESSOR_ARCHITECTURE in the $PSVersion variable.

_*Note: While posting this feedback, I notice the $env:PROCESSOR_ARCHITECTURE doesn't exit in Linux or MacOS PSCore6._

Steps to reproduce

Currently, this information is only available in the $env:PROCESSOR_ARCHITECTURE variable.

PROCESSOR_ARCHITECTURE         AMD64

Expected behavior

It could look like the following results:

PS C:\Program Files\PowerShell\6-preview> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.1.0-preview.2
PSEdition                      Core
GitCommitId                    v6.1.0-preview.2
OS                             Microsoft Windows 10.0.17661
Platform                       Win32NT
Processor_Architecture         AMD64
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Actual behavior

It doesn't exist

PS C:\Program Files\PowerShell\6-preview> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.1.0-preview.2
PSEdition                      Core
GitCommitId                    v6.1.0-preview.2
OS                             Microsoft Windows 10.0.17661
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Environment data

Windows OS: Microsoft Windows 10.0.17661

PS C:\Program Files\PowerShell\6-preview> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.1.0-preview.2
PSEdition                      Core
GitCommitId                    v6.1.0-preview.2
OS                             Microsoft Windows 10.0.17661
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Issue-Discussion

Most helpful comment

We can get this from .Net:
c#

All 6 comments

The solution to this might lie in resolving https://github.com/PowerShell/PowerShell/issues/4474.

I agree that adding the bit-ness to $PSVersionTable can't hurt, given that there's quite a bit of OS information there already.

In the meantime, [Environment]::Is64BitOperatingSystem gives you that information.

It doesn't reflect the CPU's ISA, however.

people using either 64 or 32bit processor architectures

How PowerShell scripts depends on this? Could you give business scenarios?

May be better to resolve this via https://github.com/PowerShell/PowerShell/issues/2693

Thanks everyone!!
:)

We can get this from .Net:
c#

Was this page helpful?
0 / 5 - 0 ratings