Returning a Registry KEY based on specific Values data

Welcome Forums General PowerShell Q&A Returning a Registry KEY based on specific Values data

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

1 year ago.

  • Author
  • #92057

    Points: 0
    Rank: Member

    I've been trying to create a simple command which will look through a registry path, and return the NAME of the Key if a value's data underneath that key is "Like" a string.

    I've started with:

    Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ | where { $_.DisplayName -like 'symantec' }

    Nothing gets returned.

    IF I can get something returned, I still then need to have the result be the KEY name, which is directly under "Uninstall" and of course is different for each product.

    I'm so confused 🙂 Any advice would be appreciated. I can also use a script but It would be easier with a one line command.

    Thanks in advance!

  • #92059

    Points: 642
    Helping Hand
    Rank: Major Contributor

    What you should looking for are item properties not items. Try something like this:

    Get-ChildItem -Path "REGISTRY::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" |
        Where-Object {
            (Get-ItemProperty -Path $_.PSPath -Name DisplayName).DisplayName -like '*symantec*'
        } |
            Select-Object -Property Name

    If you're using the -like operator you have to use asterisks either on one side or on both sides. Otherwise you will only find exact matches.

  • #92063

    Points: 516
    Helping Hand
    Rank: Major Contributor

    I wish I could do "Get-Childitem -Recurse HKLM: | Select-String" on the registry, but that doesn't work so well with values and data. Here's a nice registry search script:

The topic ‘Returning a Registry KEY based on specific Values data’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort