Created
April 11, 2018 13:54
-
-
Save BasLijten/3a195a0b0718db9953c905751b773b22 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
[CmdletBinding()] | |
Param( | |
[Parameter(Mandatory=$True)] | |
[string]$PackagePath, | |
[Parameter(Mandatory=$True)] | |
[string]$ParamFile, | |
[Parameter(Mandatory=$False)] | |
[string]$PackageDestinationPath = $($PackagePath).Replace(".scwdp.zip", "-nodb.scwdp.zip") | |
) | |
$msdeploy = "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" | |
$verb = "-verb:sync" | |
$source = "-source:package=`"$PackagePath`"" | |
$destination = "-dest:package=`"$($PackageDestinationPath)`"" | |
$declareParamFile = "-declareparamfile=`"$($ParamFile)`"" | |
$declareParam = "-declareparam:name=`"IIS Web Application Name`",kind=ProviderPath,scope=IisApp,match=Website,defaultValue=vanilla" | |
$skipDbFullSQL = "-skip:objectName=dbFullSql" | |
$skipDbDacFx = "-skip:objectName=dbDacFx" | |
# read parameter file | |
[xml]$paramfile_content = Get-Content -Path $ParamFile | |
$paramfile_paramnames = $paramfile_content.parameters.parameter.name | |
$params = "" | |
foreach($paramname in $paramfile_paramnames){ | |
$tmpvalue = "tmpvalue" | |
if($paramname -eq "License Xml"){ $tmpvalue = "LicenseContent"} | |
if($paramname -eq "IP Security Client IP"){ $tmpvalue = "0.0.0.0"} | |
if($paramname -eq "IP Security Client IP Mask"){ $tmpvalue = "0.0.0.0"} | |
$params = "$params -setParam:`"$paramname`"=`"$tmpvalue`"" | |
} | |
# create new package | |
Invoke-Expression "& '$msdeploy' --% $verb $source $destination $declareParam $declareParamFile $skipDbFullSQL $skipDbDacFx $params" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment