Author Posts

November 13, 2017 at 2:24 pm

I am trying to sync two web servers using below commands (reference link)

$src_publishing_file = Join-Path $ENV:TEMP ("{0}.publishsettings" -f $ENV:COMPUTERNAME)

$dst_site='testDeployement'

New-WDPublishSettings -ComputerName $ENV:COMPUTERNAME -AgentType MSDepSvc -FileName $src_publishing_file -Site $dst_site

$computer='computerName'

$dst_publishing_file = Join-Path $ENV:TEMP ("{0}.publishsettings" -f $computer)

New-WDPublishSettings -ComputerName $computer -AgentType MSDepSvc -FileName $dst_publishing_file -Site $dst_site

Sync-WDServer -SourcePublishSettings $src_publishing_file -DestinationPublishSettings $dst_publishing_file

I am getting below error, and I don't know why its not working (however normal Copy-Item command is working fine).

Sync-WDServer : (11/13/2017 4:28:38 AM) An error occurred when the request was processed on the remote computer.
Cannot create a file when that file already exists. (Exception from HRESULT: 0x800700B7)
   at Microsoft.Web.Deployment.IAppHostConfigLocationCollection.AddLocation(String bstrLocationPath)
   at Microsoft.Web.Deployment.AppHostConfigProvider.AddChild(DeploymentObject source, Int32 position, Boolean whatIf)
   at Microsoft.Web.Deployment.DeploymentObject.AddChild(DeploymentObject source, Int32 position, DeploymentSyncContext syncContext)..............

Please share your thoughts on this

November 13, 2017 at 3:12 pm

Reading the error message the first thing is to check if there's an old copy of the file on the target. Maybe do a test-path on the target and delete if its present

November 13, 2017 at 4:13 pm

Hi Richard,
There is no old copy of data. And the purpose of using Sync-WDServer command it that it itself checks that and does everything.
Regards,
PD