Jump to content

How to find if an application is installed and where ?


Recommended Posts

Some installers looking for previously installed versions of same program or something completely different.

Its not just files and known to me registry (local user/software name/keys) but something else.

Does anyone know how do other applications know where and if one or another application is installed ?

Link to comment
Share on other sites

Well, basically the developer will keep an installation log somewhere on your machine, most of the time at Program Files directory.

Maybe you can check the registry under HKLM or HKCU --> Software --> name.of.the.software

Usually, it will stated the installdirectory, just like the autoit did.

AUTOIT[sup] I'm lovin' it![/sup]

Link to comment
Share on other sites

Look in HKCU and HKLM for Software\microsoft\windows\currentversion\uninstall

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

i looked into uninstall registry and found most of them.

I also found that some like google sketchup have names like {CA9483A2-742A-4A72-881D-B81C6B1ACB3E}

Does this name change from computer to computer or not ?

Link to comment
Share on other sites

The value {CA9483A2-742A-4A72-881D-B81C6B1ACB3E} for Google Sketchup is the product code, and this can change with each version of an application. Your best search option is to search the DisplayName Key Value for the name of the application that you are looking for.

Look at this post for a function that will search for all the installed applications that are in the Add/Remove Programs list. You should be able to edit the function to search for a specific application for your specific need and return what every you need.

Adam

Link to comment
Share on other sites

hmm interesting.

I see this one application (well more then one) that are installed but have no trace in registry local or current Microsoft/windows/current/uninstall yet are on the list.

At this point whats interesting is:

What are other ways Windows or applications knows if one or another application is installed.

#1 registry uninstall information under Microsoft/windows/current/uninstall local or current user.

#2 C:\Program Files\Uninstall Information (empty)

#3 C:\Windows\Installer (found an icon of an application that is displayed in add/remove programs and nothing else)

are there any more places i should look ?

Link to comment
Share on other sites

After I did a little searching, I found that you can use the WMI Class Win32_Product to list all installed software. This may be more reliable then using the registry. Here is what is returned from the AutoIt Scriptomatic for this class.

; Generated by AutoIt Scriptomatic June 08, 2010

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"

$Output=""
$Output &= "Computer: " & $strComputer  & @CRLF
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Product", "WQL", _
                                          $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

If IsObj($colItems) then
   For $objItem In $colItems
      $Output &= "Caption: " & $objItem.Caption & @CRLF
      $Output &= "Description: " & $objItem.Description & @CRLF
      $Output &= "IdentifyingNumber: " & $objItem.IdentifyingNumber & @CRLF
      $Output &= "InstallDate: " & $objItem.InstallDate & @CRLF
      $Output &= "InstallDate2: " & WMIDateStringToDate($objItem.InstallDate2) & @CRLF
      $Output &= "InstallLocation: " & $objItem.InstallLocation & @CRLF
      $Output &= "InstallState: " & $objItem.InstallState & @CRLF
      $Output &= "Name: " & $objItem.Name & @CRLF
      $Output &= "PackageCache: " & $objItem.PackageCache & @CRLF
      $Output &= "SKUNumber: " & $objItem.SKUNumber & @CRLF
      $Output &= "Vendor: " & $objItem.Vendor & @CRLF
      $Output &= "Version: " & $objItem.Version & @CRLF
   Next
   ConsoleWrite($Output)
   FileWrite(@TempDir & "\Win32_Product.TXT", $Output )
   Run(@Comspec & " /c start " & @TempDir & "\Win32_Product.TXT" )
Else
   Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_Product" )
Endif


Func WMIDateStringToDate($dtmDate)

    Return (StringMid($dtmDate, 5, 2) & "/" & _
    StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
    & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2))
EndFunc

This can be edited to do what you need. You may find what was missing from the registry, but in the Add/Remove Programs list.

Adam

Link to comment
Share on other sites

Man all that effort. :mellow: Thank you but still, the question was:

How does windows or an application know if one or another software is installed besides listed below.

#1 registry uninstall information under Microsoft/windows/current/uninstall local or current user.

#2 C:\Program Files\Uninstall Information (empty)

#3 C:\Windows\Installer (found an icon of an application that is displayed in add/remove programs and nothing else)

or program name in program files folder.

There must be some sort of the record in files or INI's somewhere in windows.

I am looking for a trace so i can save it. Then i would clean install windows and restore the information so that that software and windows (if required) would think that its installed when in fact the application is portable or does not require installation (which is not an important factor)

For instance: I cant find any trace of 3dsmax. I would saved all autodesk registery and all files, then restore them after clean windows installation and software will work fine, but when it comes to installing plugins, plugins say that its not installed.

Somehow somewhere windows keeps info on where its installed and i gotta find it for the sake of (well: no reason, i just want to know. period)

Link to comment
Share on other sites

Windows doesn't know where everything is installed, if the installer doesn't tell it is installed. I have written plenty of install scripts for my utility scripts that just creates a folder in program files folder for the utility script executable, a start menu folder with a shortcut to the utility script, and a shortcut on the desktop, but according to Windows the utility script is not installed.

Since it is the plug-ins that are telling you that the application isn't installed, you need to find out where the plug-ins are looking to see if the application is installed, and what files the plug-in is using to the store data. Try using Process Explorer, to find out what files and registry keys are being written too. You will then have an idea of where to look. If you have two machines available, use Process Explorer to see if you can see a difference of a properly installed application with plug-ins and what you are trying to do. Good luck on searching.

Adam

Link to comment
Share on other sites

  • 8 months later...

Just wanted to say thanks for this script...

It is exactly what I was just looking for.

After I did a little searching, I found that you can use the WMI Class Win32_Product to list all installed software. This may be more reliable then using the registry. Here is what is returned from the AutoIt Scriptomatic for this class.

; Generated by AutoIt Scriptomatic June 08, 2010

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"

$Output=""
$Output &= "Computer: " & $strComputer  & @CRLF
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Product", "WQL", _
                                          $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

If IsObj($colItems) then
   For $objItem In $colItems
      $Output &= "Caption: " & $objItem.Caption & @CRLF
      $Output &= "Description: " & $objItem.Description & @CRLF
      $Output &= "IdentifyingNumber: " & $objItem.IdentifyingNumber & @CRLF
      $Output &= "InstallDate: " & $objItem.InstallDate & @CRLF
      $Output &= "InstallDate2: " & WMIDateStringToDate($objItem.InstallDate2) & @CRLF
      $Output &= "InstallLocation: " & $objItem.InstallLocation & @CRLF
      $Output &= "InstallState: " & $objItem.InstallState & @CRLF
      $Output &= "Name: " & $objItem.Name & @CRLF
      $Output &= "PackageCache: " & $objItem.PackageCache & @CRLF
      $Output &= "SKUNumber: " & $objItem.SKUNumber & @CRLF
      $Output &= "Vendor: " & $objItem.Vendor & @CRLF
      $Output &= "Version: " & $objItem.Version & @CRLF
   Next
   ConsoleWrite($Output)
   FileWrite(@TempDir & "\Win32_Product.TXT", $Output )
   Run(@Comspec & " /c start " & @TempDir & "\Win32_Product.TXT" )
Else
   Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_Product" )
Endif


Func WMIDateStringToDate($dtmDate)

    Return (StringMid($dtmDate, 5, 2) & "/" & _
    StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
    & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2))
EndFunc

This can be edited to do what you need. You may find what was missing from the registry, but in the Add/Remove Programs list.

Adam

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...