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


Please log in to comment

Community Chosen Answer

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
Set features = Nothing
Wscript.Echo message
End If
Answered 11/30/2009 by: AngelD
Red Belt

Please log in to comment
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.


Very cool. Thanks much for the quick reply, had the answer on my PC and didn't even know it. [:D]
Answered 11/30/2009 by: elgwhoppo
Senior Purple Belt

Please log in to comment
Answer this question or Comment on this question for clarity