Merge replication - Could not remove directory
The account under which xp_cmdshell is executing must have the proper access to the replication data share.

As a first step I would recommend check if xp_cmdshell is configured or not. If not, you have to enable for your purposes.


  -- To allow advanced options to be changed.
  EXEC sp_configure 'show advanced options', 1;
  GO
  -- To update the currently configured value for advanced options.
  RECONFIGURE;
  GO
  -- To enable the feature.
  EXEC sp_configure 'xp_cmdshell', 1;
  GO
  -- To update the currently configured value for this feature.
  RECONFIGURE;
  GO