Domanda

I'm having big issues with powershell, web deploy and escaping command paths. I'm trying to run a powershell script before the deployment using the runCommand provider in Web Deploy. However, powershell seems to interpret paths with spaces as seperate parameters even when I encase in double-quotes.

This is what is output if I run

web.deploy.cmd /y

Info: Updating runCommand (powershell.exe -ExecutionPolicy Bypass invoke-command "C:/local dev/mobile/Core/Web services/wsAuthUser/mobilestability/src/wsAuthUser/obj/Debug/Package/PackageTmp/install/installboot.ps1" -computername server01 -argumentlist Mobile2/AuthUser, pre).

But the error is:

Warning: Invoke-Command : A positional parameter cannot be found that accepts a
gument '

Warning: dev/mobile/Core/Web'.
At line:1 char:15

Why is it complaining when the whole path is in quotes?

Update:

If I paste the following into Powershell ISE:

invoke-command "C:\group dev\mobile\Core\Web Services\wsAuthUser\mobilestability\src\wsAuthUser\obj\Debug\Package\PackageTmp\bin\install\installboot.ps1" -computername dev-mob2iis01 -argumentlist Mobile2/AuthUser, pre

It runs fine with no errors.

If I then open a Command prompt, past the same command but pre-pend with powershell and the execution policy parameters like so:

powershell.exe -ExecutionPolicy Bypass invoke-command "C:\localdev\mobile\Core\Web Services\wsAuthUser\mobilestability\src\wsAuthUser\obj\Debug\Package\PackageTmp\bin\install\installboot.ps1" -computername server01 -argumentlist Mobile2/AuthUser, pre

It fails again.

È stato utile?

Soluzione

Because it is windows, not unix. So you would use backslashes for file paths, not regular slash.

Update: You just gotta play around with the quotes to make it work through cmd

powershell.exe -ExecutionPolicy Bypass -command "invoke-command 'C:\localdev\mobile\Core\Web Services\wsAuthUser\mobilestability\src\wsAuthUser\obj\Debug\Package\PackageTmp\bin\install\installboot.ps1' -computername server01 -argumentlist Mobile2/AuthUser, pre"
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top