EXEC.xp_cmdshell Access Denied

  • ** I have to use TSQL and xp_cmdshell so really looking for help on this permission issues. I have read what I can find and can not seem to get past this one.

    I execute:

    set @CMDSQL = 'rename G:\CustomerETL\Employee\PendingETL\' + @ETLFilename + ' ETLEmployeexls.xls'
    exec master..xp_cmdshell @CMDSQL

    I get:

    Access is denied.

    Please help.

    ** If I print to screen and copy / print the command and copy / past to a command window it runs fine.

    <hr noshade size=1 width=250 color=#BBC8E5> Regards,Jeffery Williams http://www.linkedin.com/in/jwilliamsoh

  • Jeffery Williams - Tuesday, December 19, 2017 11:37 AM

    ** I have to use TSQL and xp_cmdshell so really looking for help on this permission issues. I have read what I can find and can not seem to get past this one.

    I execute:

    set @CMDSQL = 'rename G:\CustomerETL\Employee\PendingETL\' + @ETLFilename + ' ETLEmployeexls.xls'
    exec master..xp_cmdshell @CMDSQL

    I get:

    Access is denied.

    Please help.

    ** If I print to screen and copy / print the command and copy / past to a command window it runs fine.

    It's the SQL Server service account that would need permissions to that folder, file. That's the security context used executing xp_cmdshell.

    Sue

  • Sue_H - Tuesday, December 19, 2017 11:46 AM

    Jeffery Williams - Tuesday, December 19, 2017 11:37 AM

    ** I have to use TSQL and xp_cmdshell so really looking for help on this permission issues. I have read what I can find and can not seem to get past this one.

    I execute:

    set @CMDSQL = 'rename G:\CustomerETL\Employee\PendingETL\' + @ETLFilename + ' ETLEmployeexls.xls'
    exec master..xp_cmdshell @CMDSQL

    I get:

    Access is denied.

    Please help.

    ** If I print to screen and copy / print the command and copy / past to a command window it runs fine.

    It's the SQL Server service account that would need permissions to that folder, file. That's the security context used executing xp_cmdshell.

    Sue

    Thought I had. I dug more and I thought wrong lol.

    <hr noshade size=1 width=250 color=#BBC8E5> Regards,Jeffery Williams http://www.linkedin.com/in/jwilliamsoh

  • Jeffery Williams - Tuesday, December 19, 2017 1:00 PM

    Sue_H - Tuesday, December 19, 2017 11:46 AM

    Jeffery Williams - Tuesday, December 19, 2017 11:37 AM

    ** I have to use TSQL and xp_cmdshell so really looking for help on this permission issues. I have read what I can find and can not seem to get past this one.

    I execute:

    set @CMDSQL = 'rename G:\CustomerETL\Employee\PendingETL\' + @ETLFilename + ' ETLEmployeexls.xls'
    exec master..xp_cmdshell @CMDSQL

    I get:

    Access is denied.

    Please help.

    ** If I print to screen and copy / print the command and copy / past to a command window it runs fine.

    It's the SQL Server service account that would need permissions to that folder, file. That's the security context used executing xp_cmdshell.

    Sue

    Thought I had. I dug more and I thought wrong lol.

    Hey to those interested. Turns out this was an OS issue all along. The facilities group did not assign the correct permissions and did not cascade to the sub-folders.

    Thanks everyone for the efforts and have a great Holiday season.

    <hr noshade size=1 width=250 color=#BBC8E5> Regards,Jeffery Williams http://www.linkedin.com/in/jwilliamsoh

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

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