xp_cmdshell cannot save files when SQL 2005 is running on SBS 2008
Posted on 2009-02-11
I have a stored procedure in SQL 2005 that uses XP_cmdshell to execute a VB Script. The script creates an excel spreadsheet and emails it to users.
If I run the script manually from the command prompt it works perfectly.
If I use the stored procedure it fails with the error:
e:\programs\BillBouncer\MailException.vbs(138, 1) Microsoft Office Excel: SaveAs method of Workbook class failed
I just migrated from SBS 2003 to SBS 2008. In 2003 this worked properly. I thought it was a permissions issue and have tried changing the permissions on the directory and the script so that everyone has full access. I have also changed the user that SQL runs as to Local System and a domain admin.
The problem persists.
I configured the account for the xp_cmdshell proxy user as well, no change.
To test is the problem was with SQL Server or something else I used xp_cmdshell to run an executable that also creates a file and saves it, this aslo fails through SQL but works when run outside of SQL.
Is there a setting withing SQL, or SBS 2008 to allow xp_cmdshell to save files on the server?
Any help would be greatly appreciated. The migration was totally successfull with this one exception.