Get-ChildItem returns a value I'm not interested in

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Stian Myhre Stian Myhre 1 year, 10 months ago.

  • Author
    Posts
  • #22184
    Profile photo of Stian Myhre
    Stian Myhre
    Participant

    Hi all!

    I'm quite stuck here, trying to get Powershell to return value "Name" from registry. So far, so good.

    gci $registrypath | ? {$_.Name -like "*Google*"}
    
    
        Hive: HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles
    
    
    SKC  VC Name                           Property                                                                                        
    ---  -- ----                           --------                                                                                        
     10   0 emailaddress@mydomain.com - Goo... {}                                                                                              
    

    On the other hand, if I'm trying to get the "Name" property from registry, I'm getting the full path to the registry value, and that's not what I want!

    (gci $registrypath | ? {$_.Name -like "*Google*"}).Name
    
    HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\emailaddress@mydomain.com - Google Apps
    
    

    All I want is this value: emailaddress@mydomain.com – Google Apps

    What in the #### am I doing wrong here?

  • #22191
    Profile photo of Tim Pringle
    Tim Pringle
    Participant

    Hey Stian,

    Try this :

    (gci $registrypath | ? {$_.Name -like "*Google*"}).PSChildName
    
  • #22212
    Profile photo of Stian Myhre
    Stian Myhre
    Participant

    Great, thanks! Thanks to you, I got introduced to the gm cmdlet 😀

You must be logged in to reply to this topic.