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?
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)
Please log in to answer
Posted by:
AngelD
14 years ago
Check out the WiLstPrd.vbs from the SDK.
The code-snip you're after will be:
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
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.