2

I am attempting to use MsDeploy in an Azure DevOps release pipeline. Things were not going well, so I resorted to executing a PowerShell script line-by-line on my machine in order to troubleshoot. I narrowed it down to this one command:

& "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" `
    -source:package="C:\...\Web.zip" `
    -dest:auto,computerName='https://hostname:8172/msdeploy.axd?site=Default+Web+Site,username=foo,password=foo,authtype=Basic,includeAcls=False' `
    -verb:sync `
    -disableLink:AppPoolExtension `
    -disableLink:ContentExtension `
    -disableLink:CertificateExtension `
    -setParam:"IIS Web Application Name"="Default Web Site\Folder" `
    -allowUntrusted `
    -enableRule:AppOffline `
    -enableRule:EncryptWebConfig

I keep getting the following error:

Error: Unrecognized argument '"=Default Web Site\Folder"'. All arguments must begin with "-".
Error count: 1.

I am using:

  • Microsoft (R) Web Deployment Command Line Tool (MSDeploy.exe) Version 7.1.3802.2153
  • Windows 10
  • PowerShell 5.1.19041.1320

This is the same error I am getting on our build server, which is running Windows Server 2019.

I've look at this command for hours now, and it feels like this should be a silly syntax error.

Other questions I viewed, but had no luck with the answers:

2
  • I think you're using the wrong syntax for -setParam. Try this instead -setParam:name="IIS Web Application Name",value="Default Web Site\Folder" Commented Dec 7, 2021 at 21:40
  • @TheMadTechnician: I tried that syntax as well, and it gave me the same error. The most vexing part is, I copied this from a working PowerShell script. It makes me wonder how on Earth it was ever working. Commented Dec 8, 2021 at 12:15

1 Answer 1

1

There seems to be something wonky about the -setParam argument, and how PowerShell parses these arguments. I ended up putting the IIS Web Application Name parameter in a parameter file:

& "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" `
    -source:package="C:\...\Web.zip" `
    -dest:auto,computerName='https://hostname:8172/msdeploy.axd?site=Default+Web+Site,username=foo,password=foo,authtype=Basic,includeAcls=False' `
    -verb:sync `
    -disableLink:AppPoolExtension `
    -disableLink:ContentExtension `
    -disableLink:CertificateExtension `
    -setParamFile:C:\path\to\file.xml `
    -allowUntrusted `
    -enableRule:AppOffline `
    -enableRule:EncryptWebConfig

Changed the -setParam:... argument to -setParamFile:C:\path\to\file.xml, with the contents of the XML file being:

<parameters>
    <setParameter name="IIS Web Application Name" value="Default Web Site/Folder" />
</parameters>
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.