Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guitarrapc/bc5558342aae8563826e20d09d44d955 to your computer and use it in GitHub Desktop.
Save guitarrapc/bc5558342aae8563826e20d09d44d955 to your computer and use it in GitHub Desktop.
$msdeploy = "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"
$user = "配置管理者ユーザー"
$Password = "配置管理者パスワード"
foreach ($deploygroup in $deploygroups)
{
# define arguments of msdeploy
[string[]]$arguments = @(
"-verb:sync",
"-source:package=$zip",
"-dest:auto,computerName=`"http://$deploygroup/MSDeployAgentService`",userName=$user,password=$Password,includeAcls=`"False`"",
"-disableLink:AppPoolExtension",
"-disableLink:ContentExtension",
"-disableLink:CertificateExtension",
"-setParam:`"IIS Web Application Name`"=`"W3C1hogehoge`"")
# Start Process
"running msdeploy to $deploygroup" | Out-LogHost -logfile $log -showdata
# Deploy内容が存在した際に 実行されにゃいお (更新があった場合にのみ走らないので却下です)
$processinfo = New-Object System.Diagnostics.ProcessStartInfo
$processinfo.FileName = $msdeploy
$processinfo.RedirectStandardError = $true
$processinfo.RedirectStandardOutput = $true
$processinfo.UseShellExecute = $false
$processinfo.Arguments = $arguments
$process = New-Object System.Diagnostics.Process
$process.StartInfo = $processinfo
$process.Start() > $null
$process.WaitForExit()
$output = @()
$output = $process.StandardError.ReadToEnd()
$output += $process.StandardOutput.ReadToEnd()
$output | Out-LogHost -logfile $log -hidedata
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment