SimonS
SimonS

Reputation: 1973

Sync-WDSite Web Application Physical Path Parameter

I've written a script which syncs sites between IIS Servers. All my website got synced without an error, but one site (which is of course the site which matters the most) gets a strange error.

the following code-part synchronizes the sites:

$spp = $path.Get_Item($Name)
$publishsettings = Get-WDPublishSettings -FileName $_.FullName
$sync = Sync-WDSite $Name $Name -sitephysicalpath $spp `
                                        -SourcePublishSettings $publishsettings `
                                        -IncludeApppool `
                                        -WarningAction Continue `
                                        -sourcesettings $settings `
                                        -ErrorAction Continue `
                                        -destinationsettings $settings `
                                        -debug

the error I get is the following (the error is in german, but I tried to translate it into english):

Sync-WDSite : The parameter 'Web Application Physical Path Parameter' was already defined.
In C:\Users\Administrator\desktop\wdeploy.ps1:236 Zeichen:17
+         $sync = Sync-WDSite $Name $Name -sitephysicalpath $spp `
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Sync-WDSite], DeploymentException
    + FullyQualifiedErrorId : Microsoft.Web.Deployment.PowerShell.SyncSite

I have absolutely no idea where this comes from.

Note that I used the -debug Parameter to see each step the cmdlet does. the error occurs at the stage where the other sites gathered information about the site (which site is it, which apppool does it use etc.)

Thanks!

Edit:

Additional Info: The Publish Settings File for each site has the exact same structure and looks like this:

<?xml version="1.0" encoding="utf-8"?>
<publishData>
  <publishProfile
    publishUrl="https://server:port/msdeploy.axd"
    msdeploySite="Sitename"
    destinationAppUrl="http://anysiteurl.domain.com:port/"
    mySQLDBConnectionString=""
    SQLServerDBConnectionString=""
    profileName="Default Settings"
    publishMethod="MSDeploy"
    userName="server\wdeployadmin"
    userPWD="***"
    msdeployAllowUntrustedCertificate="True"
    agentType="wmsvc"
    useNTLM="False"/>
</publishData>

Edit:

Full Error Message as requested by Martin:

writeErrorStream      : True
PSMessageDetails      :
Exception             : Microsoft.Web.Deployment.DeploymentException: Der Parameter 'Web Application Physical Path
                        Parameter' wurde bereits definiert.
                           bei Microsoft.Web.Deployment.DeploymentSyncParameterCollection.Add(DeploymentSyncParameter
                        parameter)
                           bei Microsoft.Web.Deployment.PowerShell.WDeployCmdletBase.ProcessUserCmd()
TargetObject          :
CategoryInfo          : InvalidOperation: (:) [Sync-WDSite], DeploymentException
FullyQualifiedErrorId : Microsoft.Web.Deployment.PowerShell.SyncSite
ErrorDetails          : Der Parameter 'Web Application Physical Path Parameter' wurde bereits definiert.

InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : bei <ScriptBlock>, C:\Users\Administrator\desktop\wdeploy.ps1: Zeile 245
                        bei <ScriptBlock>, C:\Users\Administrator\desktop\wdeploy.ps1: Zeile 232
                        bei <ScriptBlock>, <Keine Datei>: Zeile 1
PipelineIterationInfo : {0, 1}

Upvotes: 4

Views: 882

Answers (2)

SimonS
SimonS

Reputation: 1973

As Martin pointed out in the comments, this is a bug inside the sync-wdsite cmdlet itself. I reported it to Microsoft and hope they will fix this bug (even though I don't have that much faith in it). Feel free to vote for my issue! https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/15756139-web-deploy-snap-in-bug-report

With this command the site got deployed without any errors:

msdeploy.exe -verb=sync 
             -source:contentpath="Sitename",
                     computerName=https://Server:Port/msdeploy.axd?site=SITENAME,
                     userName=deploy,
                     password=PASSWORD,
                     authType=basic
             -dest:contentpath="D:\inetpub\path",computerName=localhost 
             -allowUntrusted

if you want to do this inside PowerShell, do something like:

$msdeployPath = 'C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe'

[string[]]$msdeployFolderSyncArgs = @(
    "-verb:sync",
     "-source:contentpath='Sitename',
                     computerName=https://Server:Port/msdeploy.axd?site=SITENAME,
                     userName=deploy,
                     password=PASSWORD,
                     authType=basic"
     "-dest:contentpath='D:\inetpub\path',computerName=localhost 
      -allowUntrusted"
)

$iex = Invoke-Expression "$msdeployPath $msdeployFolderSyncArgs"

Upvotes: 1

Martin Brandl
Martin Brandl

Reputation: 58991

You might use msdeploy.exe -verb:sync instead of the Sync-WDSite as a workaround.

Upvotes: 1

Related Questions