Author Posts

January 1, 2012 at 12:00 am

by Lery at 2013-04-28 08:29:06

Maybe I'm using the wrong command, and if so, please let me know the right one.

$regpath = Get-ChildItem "HKLM:\SOFTWARE\ABC\Updates\DEF" -Recurse

Returns this:

Name Property
—- ——–
DEF v3.1 Version : 3.1
Install Date : 03/28/13 14:34:55
Install Type : c:\temp\production_connected_full.exe
EXE Path : c:\temp\production_connected_full.exe
Environment : Production
User Type : Connected
DEF v3.1.01 Version : 3.1.01
Install Date : 04/01/13 14:34:55
Install Type : c:\temp\production_connected_full.exe
EXE Path : c:\temp\production_connected_full.exe
Environment : Production
User Type : Connected
DEF v3.1.02 Version : 3.1.02
Install Date : 04/15/13 14:34:55
Install Type : c:\temp\v3.1.02_production_connected_full.exe
EXE Path : c:\temp\v3.1.02_production_connected_full.exe
Environment : Production
User Type : Connected

I can then run $regpath.Name to return the names. I want to be able to run $regpath.version, $regpath.Environment, etc. to return those values. Note, I can run $regpath.property to return the values under properties. But I need them separately and not as one.

by DonJ at 2013-04-28 08:34:37

So, in the registry, you have ITEMS which correspond to registry keys. You also have ITEMPROPERTIES that correspond to registry settings and values; you'd use Get-ItemProperty, not Get-ChildItem, to retrieve those.

In any event, the command is returning what you asked of it. If you only want one item, you have to ask it for just that one item. You've populated $regpath with numerous items, and some of those have numerous settings. You could get to those one at a time by using their index (e.g., $variable.property[0], $variable.property[1]) if they're an indexed collection.