SQLTeam.com | Weblogs | Forums

Xp_cmdshell & vbscript

I am trying to run a vbs file. I have used:

-- enable xp_cmdshell
sp_configure 'xp_cmdshell',1
GO
RECONFIGURE
GO
sp_configure 'xp_cmdshell'
GO


DECLARE @Command VARCHAR(255) ='CMD /S/C CSCRIPT "\\MyServer\Test\Test.vbs"'
EXEC master..xp_cmdshell @Command

It is giving me an error.

Would you care telling us the error so we dont have to guess? Also what does the vbs file do?

Right now I am just testing the vbs file which returns a msgbox. the error is "Access Denied".

Which account is SQL service or integration service running as on desktop?

For those who run into this issue.

Run the following command:
EXEC xp_cmdshell 'WHOAMI'

Then give that account access to the folder.