Created
March 28, 2014 21:14
-
-
Save wurmr/9843120 to your computer and use it in GitHub Desktop.
This file contains 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
function Get-MSWebDeployInstallPath() | |
{ | |
return (get-childitem "HKLM:\SOFTWARE\Microsoft\IIS Extensions\MSDeploy" | Select -last 1).GetValue("InstallPath") | |
} | |
function Load-Configuration | |
{ | |
$webDeploy = Get-MSWebDeployInstallPath | |
$env:Path += (";" + $webDeploy) | |
} | |
try | |
{ | |
Load-Configuration | |
$Depacs = (Get-ChildItem *.dacpac | Select BaseName, FullName) | |
foreach ($depac in $Depacs) | |
{ | |
$destinationDatabase = $OctopusParameters["DbServer"]; | |
$depacFile = ($depac | Select -ExpandProperty FullName) | |
$databaseName = ($depac | Select -ExpandProperty BaseName) | |
$Args = @('-Verb:Sync', | |
"-Source:dbDacFx='$depacFile'", | |
"-Dest:dbDacFx='Server=$destinationDatabase;Database=$databaseName;Trusted_Connection=True'") | |
Write-Host $Args; | |
& 'msdeploy.exe' $Args | |
} | |
} | |
catch | |
{ | |
Write-Host $_.Exception | |
throw $_.Exception | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment