CMD permissions

  • Hi,

    When I try to execute cmd commands from mssqql, e.g. rename or copy from other server, it gives me access denied error.

    What permissions do I need ? I login in to windows as domain admin and connected to mssql as windows authentication.

    following is a chunk of code i am using

    SET @CopyCmd ='exec master.dbo.xp_cmdshell ''rename '+@ServerLoc+'Prod_neo*.bak'+' ' +' '+'Prod_neoG.bak''';

    PRINT @CopyCmd;

    EXECUTE sys.sp_executesql @CopyCmd;

  • I have reset local folder permissions and it worked for local rename. But to copy file from network path e.g. \\server\location , it is throwing access denied error.

  • IIRC xp_cmdshell runs as the engine account so you need to grant that account rights to the network shares.

  • Thank you Anthony.

    I ran SqlService under a domain privileged account and everything start working

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply