windows installer - Powershell Get MST Info -
i have read information out of msi applied mst. know how read tables pure msi don't know how apply mst.
i used msi:
process { try { # read property msi database $windowsinstaller = new-object -comobject windowsinstaller.installer $msidatabase = $windowsinstaller.gettype().invokemember("opendatabase", "invokemethod", $null, $windowsinstaller, @($path.fullname, 0)) $query = "select value property property = '$($property)'" # $query = "select action customaction action = '$($customaction)'" $view = $msidatabase.gettype().invokemember("openview", "invokemethod", $null, $msidatabase, ($query)) $view.gettype().invokemember("execute", "invokemethod", $null, $view, $null) | out-null $record = $view.gettype().invokemember("fetch", "invokemethod", $null, $view, $null) try { $value = $record.gettype().invokemember("stringdata", "getproperty", $null, $record, 1) # commit database , close view $msidatabase.gettype().invokemember("commit", "invokemethod", $null, $msidatabase, $null) | out-null $view.gettype().invokemember("close", "invokemethod", $null, $view, $null) | out-null $msidatabase = $null $view = $null } catch { $value = "-" } # return value return $value
if can me nice!
thanks, moritz :)
check out example win sdk "wilstxfm.vbs". on system it's installed @ path:
c:\program files (x86)\windows kits\8.1\bin\x64\wilstxfm.vbs
can't paste code here because of copyright issue, this:
database = installer.opendatabase(msipath,0) database.applytransform(mstpath, iteviewtransform + iteaddexistingrow + itedelnonexistingrow + iteaddexistingtable + itedelnonexistingtable + iteupdnonexistingrow + itechangecodepage) view = database.openview("select * `_transformview` order `table`, `row`")
then iterate on records of view print changes transform do.
you should able translate .vbs sample powershell code or call .vbs script ps.
Comments
Post a Comment