How can I determine what version of PowerShell is installed on a computer, and indeed if it is installed at all?
To determine the version of PowerShell installed on a computer and check if it is installed, you can use the following methods:
powershell -v
If PowerShell is installed, this command will display the version number. If it’s not installed, you might see an error or a message indicating that ‘powershell’ is not recognized as a command.
$PSVersionTable.PSVersion
This will display detailed information about the PowerShell version.
$PSVersionTable
This will display the major, minor, build, and revision numbers of the installed PowerShell version.
Get-Host
This will display information about the host environment, including the PowerShell version.
Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine' -Name PowerShellVersion
This will provide the version information.
If you are using PowerShell Core (pwsh), you can determine its version with the following command:
or
These commands will provide information about the PowerShell Core version installed.
Choose the method that best fits your preference and the information you need.