Get-ItemProperty needs a -ValueOnly parameter - by Keith Hill MVP

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 792148 Comments
Status Closed Workarounds
Type Suggestion Repros 0
Opened 7/1/2013 2:00:56 PM
Access Restriction Public


Using Get-ItemProperty to get a registry value is annoying most of the time where you want just the registry value and not a rich object that contains the PSPath, PSParentPath, PSChildName, etc.
Sign in to post a comment.
Posted by Keith Hill MVP on 5/15/2014 at 1:35 PM
I love the new functionality but I wish we weren’t introducing an inconsistency with Get-Variable -ValueOnly. Is there any chance that this could be changed to add a ValueOnly parameter to Get-ItemProperty? And then add a function Get-ItemPropertyValue and a gpv alias ala man alias -> help function -> Get-Help?

Heck, while you’re at it add a Get-VariableValue *function* and gvv alias.
Posted by Microsoft on 5/1/2014 at 8:44 PM
# Getting just the data from a registry value
pushd 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
Get-Item .
Get-ItemProperty . ProductId
(Get-ItemProperty -Path . -Name ProductId).ProductId # This is painful

# Simplified retrieving the bare value
Get-ItemPropertyValue . ProductId
gpv . ProductId