retrieving Value.Property value from hashtable

Welcome Forums General PowerShell Q&A retrieving Value.Property value from hashtable

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
3 months, 3 weeks ago.

  • Author
    Posts
  • #103792

    Participant
    Points: 0
    Rank: Member

    This code will give me a hashtable
    $fff = Get-ChildItem "HKLM:Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" -Recurse|Select-Object *|Group-Object PSChildName -AsHashTable -AsString

    Return snipet:
    Property : {Inno Setup: Setup Version, Inno Setup: App Path, InstallLocation, Inno Setup: Icon Group...}
    PSPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Skype_is1
    PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
    PSChildName : Skype_is1
    PSDrive : HKLM

    I want to return the DisplayName value from Property. How?
    Will eventually retrieve all entries but for testing have simplified it to
    $fff.'7-Zip'.Property.GetValue('DisplayName') AND .Item('DisplayName')

    thank you

  • #103793

    Participant
    Points: 5
    Rank: Member

    I am not sure I understand exactly what you are after – as when I ran your code, I did not get the same "return snippet" you mention above –

    However – would this work for you?

    $fff.psobject.properties.Item('keys').value

    -sb

    • #103795

      Participant
      Points: 0
      Rank: Member

      As it turns out the Property did not contain any values, just the listing of all the registry data
      I had to do the following
      $fff.GetEnumerator() | ForEach-Object{
      Get-ItemProperty -Path "registry::$(Convert-Path $_.Value.PSPath)"|Select-Object -ExpandProperty 'DisplayName'
      }

The topic ‘retrieving Value.Property value from hashtable’ is closed to new replies.