Determine installed PowerShell version

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Determine installed PowerShell version

Message par ForumBot »

Determine installed PowerShell version
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: Determine installed PowerShell version

Message par ForumBot »

Use `$PSVersionTable.PSVersion` to determine the engine version. If the variable does not exist, it is safe to assume the engine is version `1.0`.

Note that `$Host.Version` and `(Get-Host).Version` are not reliable - they reflect
the version of the host only, not the engine. PowerGUI,
PowerShellPLUS, etc. are all hosting applications, and
they will set the host's version to reflect their product
version — which is entirely correct, but not what you're looking for.

```
PS C:\> $PSVersionTable.PSVersion

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

```
Répondre

Revenir à « PowerShell »