Ryvik
Ryvik

Reputation: 463

Return full value of a property

I'm trying to get the Program IDs of DCOM applications but when returning the value of the property, it doesn't give the full contents.

$a = Get-ChildItem 'registry::HKEY_CLASSES_ROOT\WOW6432Node\CLSID\' -Recurse | Where-Object Name -match 'ProgID'

This returns all applications that contain a ProgID

    Hive: HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{000C1090-0000-0000-C000-000000000046}


Name                           Property
----                           --------
ProgId                         (default) : WindowsInstaller.Installer

When trying to get the property value in the example, "WindowsInstaller.Installer" via $a.Property

returns

(default)

How do I return the full property contents?

Upvotes: 1

Views: 105

Answers (1)

mklement0
mklement0

Reputation: 437062

What Get-ChildItem returns for registry locations are Microsoft.Win32.RegistryKey instances representing registry keys.

To get the data for the unnamed default value of each such key - which contains the ProgID of interest - you can use the .GetValue() method with the empty string ('').

Note that PowerShell represents the unnamed default value differently, as '(default)', as shown in your question.

Get-ChildItem registry::HKEY_CLASSES_ROOT\WOW6432Node\CLSID -Recurse | 
  Where-Object Name -match ProgID |
    ForEach GetValue ''

As an aside: the Name property of registry [Microsoft.Win32.RegistryKey] instances contains the full key path, so a better way to limit matching to just a key's name is to use
Where-Object Name -match '\\ProgID$ in your case.

Upvotes: 3

Related Questions