/build/static/layout/Breadcrumb_cap_w.png

Script to Determine features that are currently installed

Has anyone ever come across a VB method or WMI query that can tell me what features are installed for a particular MSI that is installed on a computer?

Basically, I want to write a script that takes an action depending on what features are installed for this particular MSI.

I looked Win32_SoftwareFeatureCheck and some other Windows Installer WMI classes, but couldn't find anything useful. Anybody had to do something like this?

0 Comments   [ + ] Show comments

Answers (2)

Posted by: AngelD 14 years ago
Red Belt
3
Check out the WiLstPrd.vbs from the SDK.

The code-snip you're after will be:

If InStr(1, optionFlag, "f", vbTextCompare) > 0 Then
Dim feature, features, parent, state, featureInfo
Set features = installer.Features(productCode)
message = "---Features in product " & productCode & "---"
For Each feature In features
parent = installer.FeatureParent(productCode, feature) : CheckError
If Len(parent) Then parent = " {" & parent & "}"
state = installer.FeatureState(productCode, feature)
Select Case(state)
Case msiInstallStateBadConfig: state = "Corrupt"
Case msiInstallStateIncomplete: state = "InProgress"
Case msiInstallStateSourceAbsent: state = "SourceAbsent"
Case msiInstallStateBroken: state = "Broken"
Case msiInstallStateAdvertised: state = "Advertised"
Case msiInstallStateAbsent: state = "Uninstalled"
Case msiInstallStateLocal: state = "Local"
Case msiInstallStateSource: state = "Source"
Case msiInstallStateDefault: state = "Default"
Case Else: state = "Unknown"
End Select
message = message & vbNewLine & feature & parent & " = " & state
Next
Set features = Nothing
Wscript.Echo message
End If
Posted by: elgwhoppo 14 years ago
Senior Purple Belt
0
Very cool. Thanks much for the quick reply, had the answer on my PC and didn't even know it. [:D]
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
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