ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Solved Query Regsitry using a Variable

    IT Discussion
    powershell registry
    2
    6
    504
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DustinB3403D
      DustinB3403
      last edited by

      Hey All, Hoping I can get some help as I'm just not thinking straight.

      I want to be able to use reg query $variablePathName /f /InstallDate /s

      But I'm being told that $VariablePathName isn't a valid path (no dur) yet it is if I run the prior command which gives me the path.

      How can I use reg query to search using a variable?

      1 Reply Last reply Reply Quote 0
      • DustinB3403D
        DustinB3403
        last edited by

        Get-ChildItem -path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\' | W
        here-Object -FilterScript { $_.GetValue("DisplayName") -eq 'Software' }
        

        Gets me the content I want, now I gotta filter out how I can pull just the single string I need...

        1 Reply Last reply Reply Quote 0
        • ObsolesceO
          Obsolesce
          last edited by

          Get-ChildItem -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall' | Get-ItemProperty | Where-Object -Property DisplayName -EQ "Software"
          
          #or
          
          Get-ChildItem -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall' | Get-ItemProperty | Where-Object -Property DisplayName -Match "Software"
          
          DustinB3403D 1 Reply Last reply Reply Quote 0
          • DustinB3403D
            DustinB3403 @Obsolesce
            last edited by

            @Obsolesce Yeah I got that far along, what I need to pull is a specific string from the output.

            b8887715-9354-4ff4-aef9-d3bbe0443bfb-image.png

            I have a few other ways that I was manipulating the string, like writing the entire output to a file and then pulling the 23rd line (for example) but that literally gets everything on that line.

            When all I want is the InstallDate

            ObsolesceO 2 Replies Last reply Reply Quote 0
            • ObsolesceO
              Obsolesce @DustinB3403
              last edited by

              @DustinB3403 said in Query Regsitry using a Variable:

              @Obsolesce Yeah I got that far along, what I need to pull is a specific string from the output.

              b8887715-9354-4ff4-aef9-d3bbe0443bfb-image.png

              I have a few other ways that I was manipulating the string, like writing the entire output to a file and then pulling the 23rd line (for example) but that literally gets everything on that line.

              When all I want is the InstallDate

              Get-ChildItem -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall' | Get-ItemProperty | Where-Object -Property DisplayName -EQ "Microsoft Edge" | Select-Object -Property InstallDate
              
              $InstallDate = Get-ChildItem -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall' | Get-ItemProperty | Where-Object -Property DisplayName -EQ "Microsoft Edge" | Select-Object -Property InstallDate
              $InstallDate
              $InstallDate.InstallDate
              

              5c29e20b-7437-417f-bd81-325ae4a8f3f5-image.png

              1 Reply Last reply Reply Quote 1
              • ObsolesceO
                Obsolesce @DustinB3403
                last edited by

                @DustinB3403 depending on what you want, you can also:

                $app = Get-ChildItem -Path 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall' | Get-ItemProperty | Where-Object -Property DisplayName -EQ "Microsoft Edge"
                
                $installDate = $app.InstallDate
                
                1 Reply Last reply Reply Quote 0
                • DustinB3403D DustinB3403 has marked this topic as solved on
                • 1 / 1
                • First post
                  Last post