Last updated on December 6th, 2016 at 10:36 am

If you need to run T-SQL scripts/queries that utilize the xp_cmdshell stored procedure, SQL must be reconfigured to allow this:

  • Launch SQL Management Studio and connect to the SQL server
  • In the left pane, right click on the server name and select Facets
  • Select Surface Area Configuration from the Facet drop down.
  • Double click on the line which reads XPCmdShellEnabled to change the value from False to True
  • Click OK

Another thing to keep in mind is that the SQL Server service account must have permission to any files/folders that the stored procedure will create/modify/delete!