iLLUNiS
iLLUNiS

Reputation: 35

Accessing a Property's Value?

Just starting on Powershell and cannot find a way around it. Any help greatly appreciated. Just trying to access the Property -> Version to get just the numeric result.

So from the code below i would only want 4.5.51650

Get-Childitem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full'


    Hive: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full


Name                           Property
----                           --------
1033                           Version       : 4.5.51650
                               CBS           : 1
                               TargetVersion : 4.0.0
                               Install       : 1
                               Servicing     : 0
                               Release       : 379893

Upvotes: 0

Views: 57

Answers (2)

miljbee
miljbee

Reputation: 350

Using Get-childItem and Foreach-Object because there can be several version installed:

Get-Childitem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' | Foreach-Object {$_.GetValue('Version')}

Upvotes: 0

gvee
gvee

Reputation: 17171

(Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full').Version

Upvotes: 1

Related Questions