Scripting SQL Server Replication I am trying to use SSIS to take a backup of Replication scripts. I am using Script task and using ReplicationServer class under Microsoft.SqlServer.Replication. 

The problem is, the package is failing at ReplicationServer.Script(ScriptOptions.Creation) statement with exception "You do not have sufficient permission to run this command." 

Does anyone know what kind of permissions are required?
User who runs the package must have access to the folder to which you are writing the file. User also needs access to SQL Server with sysadmin rights.

Also, verify you have properly added all libraries.

For more, please read my blog article at http://www.dbadrive.in/2013/03/ssis-package-to-backup-replication_25.html.

Please share some more details of your code if the error persists.