The distribution agent failed to create temporary files in ‘C:\Program Files\Microsoft SQL Server\110\COM’ directory.

The distribution agent failed to create temporary files in ‘C:\Program Files\Microsoft SQL Server\110\COM’ directory.

Shortly after configuring a new SQL Server 2012 server as a pull subscriber to a publication on a SQL Server 2008 Publisher/Distributor, we began receiving the following error message from the replication agents/jobs:

SQL Server Replication Error 14151

Replication-Replication Distribution Subsystem: agent PublisherNameDBNamePublicationName-62 failed. The distribution agent failed to create temporary files in ‘C:\Program Files\Microsoft SQL Server\110\COM’ directory. System returned errorcode 5.

The root cause, after much searching and testing theories, was permissions on the subscriber COM directory.

The fix was to simply grant the account that the distribution agent was running on appropriate write/modify permissions on the COM folder in question ON THE SUBSCRIBER, NOT THE PUBLISHER/DISTRIBUTOR.

Why this was not something done automatically by the replication setup process is beyond me, but once we granted the write permission to the COM folder on the subscriber (likely not necessary, but we also restarted the SQL Agent Job responsible for the distrubution), it all worked.

Hope this helps someone!

-Patrick

One Reply to “The distribution agent failed to create temporary files in ‘C:\Program Files\Microsoft SQL Server\110\COM’ directory.”

  1. Thank. You. Very Much. I have been battling this for two weeks now, frustrated that the solutions were not working. Once I read your blog and ran it on the SUBSCRIBER, everything clicked into place and worked.

Leave a Reply

Your email address will not be published. Required fields are marked *