I had a task to find out what versions of PowerShell we have installed on the computers in the domain.
PowerShell version is stored in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine\
There is a a string called PowerShell version and the value of the string is the version of the PowerShell that is installed on the computer.
After looking around I came up with the following script:
On Error Resume Next
Dim objGroup, objFSO, strFile, objFile
Const HKEY_LOCAL_MACHINE = &H80000002
Const ForWriting = 2
Const OpenAsASCII = 0
Const CreateIfNotExist = True
Const ADS_SCOPE_SUBTREE = 2
strFile = “c:\powershell.txt”
(more…)