Sign in to follow this  
Followers 0
Chimaera

Extract folder location from an Msi String?

4 posts in this topic

Hi im wondering if its possible to do as the title says, its for an uninstall tool i made to remove toolbars and scareware

I would like to tidy up afterwards by removing the folder that it was installed to

Basically by feeding a big array of uninstallers through a loop with a cleanup line to remove the folder

But

For a msi like this 

 

MsiExec.exe /I{23170F69-40C1-2702-0920-000001000000} 7zip example 

I need to be able to extract the install folder location, when the install location is specified thats fine but most are not in the registry

I came across a convo that listed this as a possible location which i will look into carefully but most dont seem to be filled in :(

 

HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionApp Paths

http://msdn.microsoft.com/en-us/library/windows/desktop/ee872121(v=vs.85).aspx

So back to the question is it possible to extract the folder location from the uninstall address like this MsiExec.exe /I{23170F69-40C1-2702-0920-000001000000} ?

Some info i read pointed to these resources

http://msdn.microsoft.com/En-US/Library/Windows/Desktop/aa372064

http://msdn.microsoft.com/en-us/library/aa370303(v=vs.85).aspx

the last one has a C++ function which i would be interested if it had an AutoIt companion

Hopefully someone has a suggestion

Many thanks

Share this post


Link to post
Share on other sites



This was the best I could come up with...

Seems like it just pulls the InstallLocation key in HKLM...Uninstall

I'll try to invest more time in it to see if I can come up with how to get the product by GUID, but maybe this will point you on the right track at least.

$installer = ObjCreate("WindowsInstaller.Installer")
$products = $installer.Products
For $product In $products
    MsgBox(0, "", "ProductName= " & $installer.ProductInfo($product, "ProductName") & " Version= " & $installer.ProductInfo($product, "Version") & @CRLF & "Location= " & $installer.ProductInfo($product, "InstallLocation"))
Next

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I already have work that gives me the uninstall key from the registry but majority of what im ununistalling are MSI GUID uninstallers

The uninstall key is often empty for location especially with some toolbars etc

The Msi string (MsiExec.exe /I{23170F69-40C1-2702-0920-000001000000})  must know the locaion of where the folder is to uninstall iit so where the hell does it find it?

Microsoft must have a hidden register somewhere

Thx for having a look

Intresting bit i just came across

http://stackoverflow.com/questions/14802473/how-to-get-folder-path-from-known-folder-guid-in-delphi

http://msdn.microsoft.com/en-gb/library/windows/desktop/dd378457(v=vs.85).aspx

Which led me to this

http://msdn.microsoft.com/en-us/library/bb762188%28v=vs.85%29.aspx

Edited by Chimaera

Share this post


Link to post
Share on other sites

I'll keep looking into it for you... I know there are a ton of MSI properties but I don't 't think they are all available outside of the MSI installing.  You are looking to get TARGETDIR.

The knownfolderID is something different entirely.  It is for getting folder paths of folders such as my documents.  Its the current equivalent to CSIDL.

I'll ask someone at work about this Monday who knows more about MSIs.  If you don't hear back from me PM me as I'm more forgetful then I would like these days.


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
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
Sign in to follow this  
Followers 0