How can I determine what version of PowerShell is installed on a computer, and indeed if it is installed at all?
I have made a small batch script that can determine PowerShell version:
@echo off
for /f "tokens=2 delims=:" %%a in ('powershell -Command Get-Host ^| findstr /c:Version') do (echo %%a)
This simply extracts the version of PowerShell using Get-Host
and searches the string Version
When the line with the version is found, it uses the for
command to extract the version. In this case we are saying that the delimiter is a colon and search next the first colon, resulting in my case 5.1.18362.752
.