Skip to content

Instantly share code, notes, and snippets.

@SergeyAxenov
Last active August 29, 2015 14:20
Show Gist options
  • Save SergeyAxenov/51200650b7e6e8b0b2a8 to your computer and use it in GitHub Desktop.
Save SergeyAxenov/51200650b7e6e8b0b2a8 to your computer and use it in GitHub Desktop.
MSDeploy RunCommand in PowerShell
# #powershell #ps #msdeploy #runCommand
function MsDeploy-RunCmd(
[string]$msdeployExe,
[string]$svr,
[string]$site,
[string]$command) {
$source="runcommand='$command'"
$dest="auto,computername=`"https://$($svr):8172/msdeploy.axd?site=$site`",authtype=`"NTLM`""
$cmd = $(" `"$msdeployExe`" -verb=sync -source={0} -dest={1} -allowuntrusted" -f $source, $dest)
cmd.exe /C $cmd
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment