$key = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion'
(Get-ItemProperty -Path $key -Name ProgramFilesDir).ProgramFilesDir
I’ve never liked how this was provider was implemented like this : /
Basically, it makes every registry value a PSCustomObject
object with PsPath
, PsParentPath
, PsChildname
, PSDrive
and PSProvider
properties and then a property for its actual value. So even though you asked for the item by name, to get its value you have to use the name once more.