11 Replies Latest reply on Dec 24, 2019 6:52 AM by Joseph Ruiz

    get GUID of software installed

    Greg Tompkins
      Share This:

      Hello,

       

      I need an operational rule to get the following

       

      GUID

      uninstall string from registry in the Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

      and source from that same key and in Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall tree also

       

      I can almost get what I am after from this wmic command but I don't know how to read the result into a text file and bring it into custom inventory

      wmic product get identifyingnumber,name,vendor,version

       

      My ultimate goal I want to run some reporting to identify all the versions of the software I have and determine how to go about cleaning it up because some of the software was deployed manually, some paths no longer exist and you can't run an MSIEXEC /X on something that it cannot find the .MSI

       

      Thank You so much.

       

      GregT

        • 1. Re: get GUID of software installed
          Joseph Ruiz

          PowerShell will parse WMIC for you and you can generate a .csv with the data in rows and columns.

           

          Viewing

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

           

          Exporting

          Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate, UninstallString | Export-csv testexport.csv -NoTypeInformation

          • 2. Re: get GUID of software installed
            Greg Tompkins

            Hi Joseph,

             

            Wow, thank you so much for that. Now I need to know how to do that from an Operational Rule and copy into a CustomInventory

             

            Thanks again

             

            GregT

            1 of 1 people found this helpful
            • 3. Re: get GUID of software installed
              Steve Gibbs

              Hi Greg Tompkins,

               

              Please read my post(s) about collecting uninstall strings and adding to custom inventory:

               

              How to add ALL Uninstall Strings to Custom Inventory

              Collect ALL Windows Registry Keys for Uninstall Strings (Custom Inventory)

               

              I add two separate posts to assist users like yourself to do exactly what you are trying to do...  If you had searched the Community using this URL:

               

              Search BCM Community: https://communities.bmc.com/search.jspa?place=%2Fplaces%2F118667&depth=all

               

              And used "uninstall string" and your criteria you would have found these on your own...  I bookmark that search string because I use it ALL the time...

               

              Hope this helps you,

               

              Steve G.

              2 of 2 people found this helpful
              • 4. Re: get GUID of software installed
                Greg Tompkins

                Hi Steve,

                 

                Would it also be possible to capture InstallDate and DisplayVersion if those keys exist?

                 

                It's a little bit frustrating that some of these seemingly easy things are not more readily available than via script but I am very glad you found a way to do this. It will be a huge help for me trying to clean up the myriad software we have installed via many different ways. We are standardizing the way things are done in our environment.

                 

                Thanks for your help and Happy Thanksgiving!

                • 5. Re: get GUID of software installed
                  Steve Gibbs

                  Greg Tompkins,

                   

                  Feel free to modify the batch files and also update the Regular Expression Step to include the additional fields you wish to capture.  Not sure why you would need to add the extra columns. The regular "Scanned Applications" inventory should provide what you need.  The Name column should be enough to provide you the required uninstall strings but maybe I am missing something.

                   

                  You do understand that any MSI packages that were installed can be uninstalled using the Op Rule Step "Uninstall MSI" by simply using the "EXACT" name found in Add/Remove Programs so a GUID or Product ID value is NOT required!  Only those software titles that were not installed using MSI installers would require the values found under the uninstall string in the registry.

                   

                  Please clarify if I misunderstood your requirements.

                   

                  Steve G.

                  • 6. Re: get GUID of software installed
                    Joseph Ruiz

                    PowerShell also gives you a list of properties you can query for using the Get-Member commandlet. I'm not saying PowerShell is better than .bat files, but it is a rather powerful shell scripting tool..

                     

                    Properties for Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*

                     

                     

                     

                     

                    Name            MemberType   Definition                                                                                                     

                    ----            ----------   ----------                                                                                                     

                    Equals          Method       bool Equals(System.Object obj)                                                                                 

                    GetHashCode     Method       int GetHashCode()                                                                                              

                    GetType         Method       type GetType()                                                                                                 

                    ToString        Method       string ToString()                                                                                              

                    DisplayIcon     NoteProperty string DisplayIcon=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe        

                    DisplayName     NoteProperty string DisplayName=Visual Studio Community 2019                                                                

                    DisplayVersion  NoteProperty string DisplayVersion=16.3.29326.143                                                                           

                    InstallDate     NoteProperty string InstallDate=20190614                                                                                    

                    InstallLocation NoteProperty string InstallLocation=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community                           

                    ModifyPath      NoteProperty string ModifyPath="C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" modify --instal...

                    PSChildName     NoteProperty string PSChildName=40c29b56                                                                                    

                    PSDrive         NoteProperty PSDriveInfo PSDrive=HKLM                                                                                       

                    PSParentPath    NoteProperty string PSParentPath=Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Win...

                    PSPath          NoteProperty string PSPath=Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\C...

                    PSProvider      NoteProperty ProviderInfo PSProvider=Microsoft.PowerShell.Core\Registry                                                     

                    Publisher       NoteProperty string Publisher=Microsoft Corporation                                                                         

                    RepairPath      NoteProperty string RepairPath="C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" repair --instal...

                    UninstallString NoteProperty string UninstallString="C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" uninstall ...

                    • 7. Re: get GUID of software installed
                      Greg Tompkins

                      Hi Joseph,

                      I tried using this way too, and follow up with CSV File Import but the result is empty. What am I doing incorrectly?

                       

                       

                      Thanks!

                      • 8. Re: get GUID of software installed
                        Joseph Ruiz

                        If you type in powershell get-executionpolicy in the command line on that host, what is returned?

                        • 9. Re: get GUID of software installed
                          Greg Tompkins

                          Unrestricted

                          • 10. Re: get GUID of software installed
                            Greg Tompkins

                            Hi Joseph,

                             

                            I modified my steps a little bit:

                             

                            powershell -ExecutionPolicy ByPass "Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate, UninstallString, InstallSource | Export-csv C:\BMC\Pshell-SWImport1.CSV -NoTypeInformation"

                             

                            But I think to do the CSV Import step I need the Host Name as the first column in the CSV

                             

                            Do you know how I can pull that in?

                             

                            Thanks!

                            1 of 1 people found this helpful
                            • 11. Re: get GUID of software installed
                              Joseph Ruiz

                              You can add this before display name. It will take longer to execute each row though.

                              Select-Object @{N="HostName"; E={hostname}},