/build/static/layout/Breadcrumb_cap_w.png

Searching for installed MSI's via WiseScript

Add the following as it's own WSE file called AppSearch.

item: Remark
Text=<<<<<<<<<<<<Check if PRODCODE is INSTALLED>>>>>>>>>>>>>>
end
item: Call DLL Function
Pathname=%SYS32%\msi.dll
Function Name=MsiQueryProductStateA
Argument List=40PRODCODE
Return Variable=0INSTALL_STATE
Flags=00100000
end
item: Set Variable
Variable=APPINSTALLED
Value=DontKnowYet
end
item: If/While Statement
Value=(INSTALL_STATE = 5) OR (INSTALL_STATE = 2)
Flags=00001101
end
item: Set Variable
Variable=APPINSTALLED
Value=YES
end
item: End Block
end
item: Set Variable
Variable=PRODCODE
Value=%RESET%
end

Then any time you want to search for a product just reference it in your main WSE like this..

item: Include Script
Pathname=.\AppSearch.wse
end
item: If/While Statement
Variable=APPINSTALLED
Value=YES
end

You will need the following before you call your include file.. (I have a Variable Section at the top of my Main WSE)

item: Set Variable
Variable=PRODCODE
Value=ADD PRODUCT CODE HERE
end
item: Set Variable
Variable=RESET
Value=%PRODCODE%
end

 

<<NOTE>>

The reason for the RESET property to be set the same as PRODCODE is that I was using my main WSE to locate and or uninstall the main product code, but if I needed to find another product like a PreReq product, I could use the same include file every time I needed to check for an installed product without having to use a different variable. All I would do is add a new line in the script that sets the variable PRODCODE to a different PreReq product code, right before the Include command. In this way you can set the PRODCODE variable 100 times if you wanted to, and will not have to edit the include file.

ex..

PRODCODE={code for .net4.0}

include script - AppSearch.wse

if APPINSTALLED = YES

add text to Log - found .NET on this pc

else

add text to Log - .NET not on this pc

end

PRODCODE={code for VCRedist 2010 }

include script - AppSearch.wse

and repeat like above...


Comments

This post is locked
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ