1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| Option Explicit
Dim msiObject, msiProduct, strProdList, strProdInfo, msiProdVersion,appName, CommandShell, cmdline
Const msiInstallStateDefault = 5
appName = "Sym"
strProdList = ""
Set msiObject = Wscript.CreateObject("WindowsInstaller.Installer")
For Each msiProduct In msiObject.Products
msiProdVersion = CLng(msiObject.ProductInfo(msiProduct, "Version"))
msiProdVersion = (msiProdVersion\65536\256) & "." & (msiProdVersion\65535 MOD 256) & "." & (msiProdVersion Mod 65536)
strProdInfo = ""
if msiObject.ProductInfo(msiProduct, "ProductName") = appName
strProdInfo = "Product GUID: " & msiProduct & vbCrLf _
& "Name: " & msiObject.ProductInfo(msiProduct, "ProductName") & vbCrLf _
& "Version: " & msiProdVersion
set CommandShell = createobject("wscript.shell")
cmdline = "msiexec /X" & msiProduct & " /qn"
wscript.echo cmdline
CommandShell.run cmdline, 1, true
END IF
If strProdList = "" Then
strProdList = strProdInfo
Else
strProdList = strProdList & vbCrLf & vbCrLf & strProdInfo
End If
Next
If strProdList = "" Then
strProdList = "No products installed or advertised."
Else
strProdList = "There are " & msiObject.Products.Count & " product(s) installed or advertised." & vbCrLf & vbCrLf & strProdList
End If
Wscript.Echo strProdList |
Partager