How to check the PowerShell version

How to check the PowerShell version


Sometimes we want to run a cmdlet but we got an error like:

“The term ‘Compress-Archive’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.”


And it’s because we don’t have the module installed or because we are running another version of PowerShell.
To have all the information we can run the follow cmdlets or local variables.
The first one is Get-Host


This cmdlet provides detailed information about the version of Windows PowerShell that is currently running  and the current culture (Language) and UI culture of Windows PowerShell. You can also use this cmdlet to customize features of the host program user interface, such as the text and background colors.
I will show you in another post how to change the background, font and colors in PowerShell.

The next one is a local variable $Host.  The host object contains the same information as the above cmdlet.

The last one that I know is $PSVersionTable As well has the version information and more information that can be helpful. 


If you know another cmdlet or another way to get this information, please do let me know.
Advertisement