Filtering Registry Key, value Pairs

This topic contains 3 replies, has 3 voices, and was last updated by Profile photo of Brad Brad 2 weeks, 4 days ago.

  • Author
    Posts
  • #68062
    Profile photo of Andrew
    Andrew
    Participant

    I am trying to get the name and value of each key pair using the following in Powershell v5

    $path = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*'
    $key = Get-Item $path

    $namevalues=$key.getvaluenames() | ForEach-Object {[PSCustomObject] @{name=$_; Value=$key.Getvalue($_)}}

    I have become stuck, and would appreciate any assistance to rectify this. I seem to be part of the way there but an issue is getting to corresponding key value out, I can get only as far as the name, but can't get the corresponding value.

    Thanks

  • #68065
    Profile photo of Hermann
    Hermann
    Participant

    What information would you like to get?
    Installed Software?

    If you have System Center Configuration Manager (SCCM) in your environment try this

    $computer = "LocalHost" 
    $namespace = "root\cimv2\sms" 
    Get-WmiObject -class SMS_InstalledSoftware -computername $computer -namespace $namespace | out-gridview
    • #68067
      Profile photo of Andrew
      Andrew
      Participant

      Thanks for that – will check it out, I suffer from over thinking things when Powershell makes it 'easy' – I find this out after banging head for a while.

      I put together this which gets me to where I need, interested in getting the uninstall path of installed software as one part of my problems. Should be OK now – Thanks!

      $path = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*'
      Get-ChildItem -Path $path | Get-ItemProperty | Where-Object{$_.uninstallstring}

  • #68100
    Profile photo of Brad
    Brad
    Participant

    Try this:

    Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* |  Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize

You must be logged in to reply to this topic.