Link to home
Start Free TrialLog in
Avatar of footech
footechFlag for United States of America

asked on

Retrieving registry values with Get-ItemProperty

Regarding registry queries, I've often seen the advice that you need to specify the name of the property with get-itemproperty, and then use the property name again using the dot method to retrieve the value.  For example:
(Get-ItemProperty HKLM:\SOFTWARE\Intel\Infinst -name Infver).Infver

Open in new window


However, in my experience there's no need to supply the name twice.  The below works just fine.
(Get-ItemProperty HKLM:\SOFTWARE\Intel\Infinst).Infver

Open in new window


I was wondering if anyone knew some background on this and whether there are any circumstances where my method wouldn't work.  It's been tested with both PS 2.0 and 3.0, don't know about 1.0.  I can't understand why the previous advice prevails when it doesn't seem to be needed.
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of footech

ASKER

Interesting observation.  The syntax does seem to behave more like the -filter parameter on gci than the -include parameter (for instance, using wildcards).  If I ever run into a reg key with a large amount of values, I'll have to remember this and see if there's any measureable performance difference.
If we could use get-itemproperty remotely, the potential impact would be noticable - if there is any.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of footech

ASKER

I appreciate the feedback guys!