Re: Cscript from a SQL Stored Procedure?

From: Sue Hoegemeier (Sue_H_at_nomail.please)
Date: 10/26/04


Date: Mon, 25 Oct 2004 20:45:55 -0600

You may want to check the proxy account. When non-sysadmins
execute xp_cmdshell, it will run under the security context
of the SQL Server Agent proxy account. You'll want to check
how the proxy account is configured and what permissions it
has.

-Sue

On Mon, 25 Oct 2004 14:27:04 -0700, Carlos
<Carlos@discussions.microsoft.com> wrote:

>Hopefully, someone can help me out with this.
>
>I'm trying to run a .vbs script using cscript from a stored procedure that
>gets called from a powerbuilder application (our commerce software)
>that uses SQL SERVER 2000 as it's database.
>
>Basically we are trying to add code that calls the .vbs script so that when
>an invoice prints it also calls the .vbs script to print a packing list as
>well.
>
>The .vbs file simply formats some data, and creates a file.
>
>I can run everything fine from Query Analyzer, however when the
>stored procedure gets called from the application. I get this error :
>
>CScript Error: Loading your settings failed. (Access is denied.)
>
>Here is how the .vbs script is being called :
>
>DECLARE @STR varchar(255)
>SET @STR = 'cscript //nologo c:\PACKING_LIST.vbs 2265440 > c:\OUTPUT.DAT'
>exec master..xp_cmdshell @STR, NO_OUTPUT
>
>2265440 is simply an invoice no passed in as a parameter.
>
>I've been able to establish that xp_cmdshell does run. Using :
>
>SET @STR = 'dir /p > c:\OUTPUT.TXT'
>
>I was able to get the directory listing redirected to the output.txt file
>successfully.
>However, when the stored procedure is being called from the application
>'cscript'
>doesn't seem to execute.
>
>Also our SQL Server is running under an administrator login, versus sa.
>
>Any help is appreciated.
>
>Carlos
>



Relevant Pages

  • Re: SQL Server Agent Proxy Account / XP_CMDSHELL
    ... The proxy account is unrelated to SQL Server object permissions. ... must have xp_cmdshell execute permissions when xp_cmdshell executed ... execute permissions on xp_cmdshell. ...
    (microsoft.public.sqlserver.security)
  • Re: xp_cmdshell
    ... execute xp_cmdshell not else.. ... xp_cmdshell will impersonate the SQL Server Agent ... > How to set the proxy account: ... Open enterprise manager and select management options ...
    (microsoft.public.sqlserver.clients)
  • Re: Calling a .Net assembly from a SQL2000 procedure
    ... I'm not sure if this can be done, but I usually start w/a VBS script, debugg it ... a .Net assembly from a stored procedure, many threads reference the Microsoft KB ... Load CLR in SQL Server Is Not Supported". ... > I've tested the above scenario and I can call the .Net assembly from a stored ...
    (microsoft.public.sqlserver.programming)
  • RE: Unable to set the SQL Agent proxy account
    ... The Proxy Account should not be the same account used to ... Start SQL Server and SQL Agent. ... SQL Server Agent proxy accounts allow SQL Server users who do not belong to ... SQL Server Agent jobs. ...
    (microsoft.public.sqlserver.security)
  • Re: Calling a .Net assembly from a SQL2000 procedure
    ... > simple VBS script for a simple Hello World .Net Assembly. ... > HTH ... > a .Net assembly from a stored procedure, ... > IN-PROCESS in the SQL Server memory space. ...
    (microsoft.public.sqlserver.programming)