How can I determine what version of PowerShell is installed on a computer, and indeed if it is installed at all?
Microsoft's recommended forward compatible method for checking if PowerShell is installed and determining the installed version is to look at two specific registry keys. I've reproduced the details here in case the link breaks.
According to the linked page:
Depending on any other registry key(s), or version of PowerShell.exe or the location of PowerShell.exe is not guaranteed to work in the long term.
To check if any version of PowerShell is installed, check for the following value in the registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1
To check whether version 1.0 or 2.0 of PowerShell is installed, check for the following value in the registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine