Created
June 4, 2025 13:42
-
-
Save sevaa/39baafbd6b88115b782b37de163c84fd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param($Src, $Dest, $Name) | |
function CopyRecset($Table, $KeyField) | |
{ | |
$svw = $sdb.OpenView("select * from $Table where $KeyField=?") | |
$svw.Execute($NameParam) | |
$sdr = $svw.Fetch() | |
$dvw = $ddb.OpenView("select * from $Table") | |
$dvw.Execute($null) | |
while($null -ne $sdr) | |
{ | |
$dvw.Modify(5 <# msiViewModifyMerge #>, $sdr) | |
$sdr = $svw.Fetch() | |
} | |
$svw.Close() | |
$svw = $null | |
$dvw.Close() | |
$dvw = $null | |
} | |
$inst = New-Object -COM "WindowsInstaller.Installer" | |
$sdb = $inst.OpenDatabase($Src, 0) | |
$ddb = $inst.OpenDatabase($Dest, 2) | |
$NameParam = $inst.CreateRecord(1) | |
$NameParam.StringData(1) = $Name | |
CopyRecset "Dialog" "Dialog" | |
CopyRecset "Control" "Dialog_" | |
CopyRecset "ControlCondition" "Dialog_" | |
CopyRecset "ControlEvent" "Dialog_" | |
$ddb.Commit() | |
$ddb = $null | |
$sdb = $null | |
$inst = $null | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment