The smart home has gone through quite a convergence in the last few years. Modern…
Running MSDEPLOY from PowerShell
I had to spend quite a bit of time figuring this out. So hopefully this will help someone out there. To launch MSDEPLOY from PowerShell, make sure you escape any quote or comma characters.
The “2>&1” at the end allows Powershell to detect errors and bail out if you have $ErrorActionPreference = “Stop”
If you still have problems, download and use EchoArgs.exe to see exactly what PowerShell sees.
Example
function Get-MSWebDeployInstallPath(){
$path = (get-childitem "HKLM:\SOFTWARE\Microsoft\IIS Extensions\MSDeploy" | Select -last 1).GetValue("InstallPath")
$path = "${path}msdeploy.exe"
if (!(Test-Path "$path")) {
throw "MSDEPLOY.EXE is not installed. See http://go.microsoft.com/?linkid=9278654"
}
return $path
}
$msdeploy = Get-MSWebDeployInstallPath
& $msDeploy -verb:sync -source:recycleApp `
-dest:recycleApp=`"${webSiteName}`"`,recycleMode=StopAppPool`,wmsvc=${server}`,userName="${userName}"`,password="${password}" `
-allowuntrusted -debug 2>&1
This Post Has 0 Comments