Get only the version number of software from Reg

I am trying to get just the version number from a registry key and it is proving to be very hard. I have this code which works but it will give me the following:


$VER = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall |
Get-ItemProperty | Where-Object { $_.DisplayName -match “Common.*Core” } | Select-Object -Property displayversion -unique

All I want is the and I don’t want to have to use regular expressions etc… can’t you search for a Display Name and get just the version number from the registry?

Thank you.

When you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.

Thanks in advance

How to format code in 1 <---- Click :point_up_2:t4: :wink:

Either you do



$VER = 
    Get-ChildItem -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' |
        Get-ItemProperty | 
            Where-Object { $_.DisplayName -match 'Common.*Core' } | 
                Select-Object -ExpandProperty DisplayVersion