locked
Listing all the patches available for particular software in remote machine RRS feed

  • Question

  •  $UninstallKey="HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Installer\\Patches\\241630F0445788D4A862850B488648A9\\SourceList"
        #Create an instance of the Registry Object and open the HKLM base key

        $reg=[microsoft.win32.registrykey]::OpenRemoteBaseKey('LocalMachine','machinename') 


        #Drill down into the Uninstall key using the OpenSubKey Method

        $regkey=$reg.OpenSubKey($UninstallKey) 

        #Retrieve an array of string that contain all the subkey names

        $subkeys=$regkey.GetSubKeyNames() 

        #Open each SHKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Patches\41354CB878A265745813AF76B63C05D5\SourceListubkey and use GetValue Method to return the required values for each
        
        #$UserInfo = Get-CimInstance –ComputerName $pc –ClassName Win32_ComputerSystem | Select-Object UserName
        foreach($key in $subkeys)
        {
     
            $thisKey=$UninstallKey+"\\"+$key 

            $thisSubKey=$reg.OpenSubKey($thisKey) 

            $obj = New-Object PSObject
               
            $obj | Add-Member -MemberType NoteProperty -Name "DisplayName" -Value $($thisSubKey.getvalue("PackageName"))
            
     
            $array += $obj
             
        }

      $array | select DisplayName | Where-Object {$_.DisplayName -like "Sunrise Enterprise Scheduling 17.3 Engine Services"}
    • Edited by Rippal Tuesday, August 14, 2018 6:06 AM
    Tuesday, August 14, 2018 6:06 AM

All replies

  • Is there a question or are you just sharing some code?


    \_(ツ)_/

    Tuesday, August 14, 2018 6:15 AM
  • Hi Rippal,

    I think you probably forgot to post your question

    When I check your script, I found a problem.

      $obj = New-Object PSObject
               
            $obj | Add-Member -MemberType NoteProperty -Name "DisplayName" -Value $($thisSubKey.getvalue("PackageName"))
            
     
            $array += $obj

    Your variable $obj just run the command "new-object PSObject", so $array can't get the output you want.

      $obj = New-Object PSObject
               
            $test=$obj | Add-Member -MemberType NoteProperty -Name "DisplayName" -Value $($thisSubKey.getvalue("PackageName"))
            
     
            $array += $test

    You can change it by the example.

    Best Regards,

    Lee


    Just do it.

    Tuesday, August 14, 2018 8:19 AM
  • The code posted in totally incorrect and unusable for many reasons.  The key I not in the correct format and there is no such key for the installer.

    There are a number of scripts in the Gallery that show how to get the installed software remotely.


    \_(ツ)_/

    Tuesday, August 14, 2018 10:29 AM
  • This is all you need to get the name of the package'  Not there is no value named "DisplayName"

    $computer = 'Alpha'
    $keyPath = 'SOFTWARE\Classes\Installer\Patches\241630F0445788D4A862850B488648A9\SourceList'
    $reg = [microsoft.win32.registrykey]::OpenRemoteBaseKey('LocalMachine',$computer) 
    $reg.OpenSubKey($keyPath).GetValue('PackageName')


    \_(ツ)_/


    • Edited by jrv Tuesday, August 14, 2018 10:47 AM
    Tuesday, August 14, 2018 10:46 AM
  • I asked if there was a question because there is no way to know what is needed.  It appears that multiple scripts have been merged and modified and there is no way to tell what is needed.  The key is not an uninstaller key.

    Answering this with no question is pointless.


    \_(ツ)_/

    Tuesday, August 14, 2018 10:50 AM