Showing posts with label cscript. Show all posts
Showing posts with label cscript. Show all posts

Tuesday, February 14, 2012

Cscript from a SQL Stored Procedure?

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.
CarlosYou 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
>|||Sue,
Thank-you for your help. I revisted our security & proxy accout setup.
Turns out the proxy acccount we setup didn't have log-in permissions
to our Sql Server. The application that was calling the stored procedure
and making the xp_cmdshell call was on another server. Once I changed
the proxy account to a valid login on the Sql Server everything worked
fine. Again thanks!
Carlos
"Sue Hoegemeier" wrote:

> 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:
>
>|||You're very welcome Carlos - thanks for posting back the results!
-Sue
On Wed, 27 Oct 2004 12:47:02 -0700, Carlos
<Carlos@.discussions.microsoft.com> wrote:
[vbcol=seagreen]
>Sue,
>Thank-you for your help. I revisted our security & proxy accout setup.
>Turns out the proxy acccount we setup didn't have log-in permissions
>to our Sql Server. The application that was calling the stored procedure
>and making the xp_cmdshell call was on another server. Once I changed
>the proxy account to a valid login on the Sql Server everything worked
>fine. Again thanks!
>Carlos
>
>"Sue Hoegemeier" wrote:
>

Cscript from a SQL Stored Procedure?

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
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
>
|||Sue,
Thank-you for your help. I revisted our security & proxy accout setup.
Turns out the proxy acccount we setup didn't have log-in permissions
to our Sql Server. The application that was calling the stored procedure
and making the xp_cmdshell call was on another server. Once I changed
the proxy account to a valid login on the Sql Server everything worked
fine. Again thanks!
Carlos
"Sue Hoegemeier" wrote:

> 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:
>
>
|||You're very welcome Carlos - thanks for posting back the results!
-Sue
On Wed, 27 Oct 2004 12:47:02 -0700, Carlos
<Carlos@.discussions.microsoft.com> wrote:
[vbcol=seagreen]
>Sue,
>Thank-you for your help. I revisted our security & proxy accout setup.
>Turns out the proxy acccount we setup didn't have log-in permissions
>to our Sql Server. The application that was calling the stored procedure
>and making the xp_cmdshell call was on another server. Once I changed
>the proxy account to a valid login on the Sql Server everything worked
>fine. Again thanks!
>Carlos
>
>"Sue Hoegemeier" wrote:

Cscript from a SQL Stored Procedure?

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.
CarlosYou 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
>|||Sue,
Thank-you for your help. I revisted our security & proxy accout setup.
Turns out the proxy acccount we setup didn't have log-in permissions
to our Sql Server. The application that was calling the stored procedure
and making the xp_cmdshell call was on another server. Once I changed
the proxy account to a valid login on the Sql Server everything worked
fine. Again thanks!
Carlos
"Sue Hoegemeier" wrote:
> 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
> >
>|||You're very welcome Carlos - thanks for posting back the results!
-Sue
On Wed, 27 Oct 2004 12:47:02 -0700, Carlos
<Carlos@.discussions.microsoft.com> wrote:
>Sue,
>Thank-you for your help. I revisted our security & proxy accout setup.
>Turns out the proxy acccount we setup didn't have log-in permissions
>to our Sql Server. The application that was calling the stored procedure
>and making the xp_cmdshell call was on another server. Once I changed
>the proxy account to a valid login on the Sql Server everything worked
>fine. Again thanks!
>Carlos
>
>"Sue Hoegemeier" wrote:
>> 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
>> >
>>

cscript execution problems after windows updates/ie7 install

after windows updates/ie7 install on windows 2003 SP1 machine with SQL2000
SP4 buil 8.0.2039 we can no longer execute cscript from sql example:
***********************
declare @.script varchar(8000)
set @.script = 'cscript.exe'
create table #output (
output varchar(8000)
)
insert into #output
exec master.dbo.xp_cmdshell @.script
select * from #output
drop table #output
***********************
returns NULL
Any ideas?
my error was slightly different and I tried all sorts of things from checking
the nessessary permissions for sql service accounts to proxy accounts etc. at
the end I ended up manually uninstalling one by one all microsoft patches I
installed that caused this and it fixed it!
check that the service account sql is running under has permission for the
following:
NTFS for C:\Program Files\Microsoft SQL Server\MSSQL
Read and write for registry keys at and under:
HKEY_LOCAL_MACHINE\Software\Microsoft\MSSQLServer
HKEY_LOCAL_MACHINE\System\CurrentControlset\Servic es\MSSQLServer
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Perflib
HKEY_LOCAL_MACHINE\Software\Clients\Mail
User Rights:
Act as Part of the Operating System = SeTcbPrivilege
Bypass Traverse Checking = SeChangeNotify
Lock Pages In Memory = SeLockMemory
Log on as a Batch Job = SeBatchLogonRight
Log on as a Service = SeServiceLogonRight
Replace a Process Level Token = SeAssignPrimaryTokenPrivilege
good luck
"Laurence Neville" wrote:

> George - did you figure the answer out? I am having a very similar problem -
> I used to run a VBS file that lives on a remote server with cscript through
> XP_CMDSHELL, and suddenly I am getting "Access is Denied". See the thread in
> this group:
> Access is Denied when accessing files on remote server thru XP_CMDSHELL (was
> working last week)
>
>
> "George" <George@.discussions.microsoft.com> wrote in message
> news:6893962E-3AB1-4154-9E15-E0562233283E@.microsoft.com...
>
>

cscript execution problems after windows updates/ie7 install

after windows updates/ie7 install on windows 2003 SP1 machine with SQL2000
SP4 buil 8.0.2039 we can no longer execute cscript from sql example:
***********************
declare @.script varchar(8000)
set @.script = 'cscript.exe'
create table #output (
output varchar(8000)
)
insert into #output
exec master.dbo.xp_cmdshell @.script
select * from #output
drop table #output
***********************
returns NULL
Any ideas?George - did you figure the answer out? I am having a very similar problem -
I used to run a VBS file that lives on a remote server with cscript through
XP_CMDSHELL, and suddenly I am getting "Access is Denied". See the thread in
this group:
Access is Denied when accessing files on remote server thru XP_CMDSHELL (was
working last week)
"George" <George@.discussions.microsoft.com> wrote in message
news:6893962E-3AB1-4154-9E15-E0562233283E@.microsoft.com...
> after windows updates/ie7 install on windows 2003 SP1 machine with SQL2000
> SP4 buil 8.0.2039 we can no longer execute cscript from sql example:
> ***********************
> declare @.script varchar(8000)
> set @.script = 'cscript.exe'
> create table #output (
> output varchar(8000)
> )
> insert into #output
> exec master.dbo.xp_cmdshell @.script
> select * from #output
> drop table #output
> ***********************
> returns NULL
> Any ideas?|||my error was slightly different and I tried all sorts of things from checking
the nessessary permissions for sql service accounts to proxy accounts etc. at
the end I ended up manually uninstalling one by one all microsoft patches I
installed that caused this and it fixed it!
check that the service account sql is running under has permission for the
following:
NTFS for C:\Program Files\Microsoft SQL Server\MSSQL
Read and write for registry keys at and under:
HKEY_LOCAL_MACHINE\Software\Microsoft\MSSQLServer
HKEY_LOCAL_MACHINE\System\CurrentControlset\Services\MSSQLServer
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Perflib
HKEY_LOCAL_MACHINE\Software\Clients\Mail
User Rights:
Act as Part of the Operating System = SeTcbPrivilege
Bypass Traverse Checking = SeChangeNotify
Lock Pages In Memory = SeLockMemory
Log on as a Batch Job = SeBatchLogonRight
Log on as a Service = SeServiceLogonRight
Replace a Process Level Token = SeAssignPrimaryTokenPrivilege
good luck
"Laurence Neville" wrote:
> George - did you figure the answer out? I am having a very similar problem -
> I used to run a VBS file that lives on a remote server with cscript through
> XP_CMDSHELL, and suddenly I am getting "Access is Denied". See the thread in
> this group:
> Access is Denied when accessing files on remote server thru XP_CMDSHELL (was
> working last week)
>
>
> "George" <George@.discussions.microsoft.com> wrote in message
> news:6893962E-3AB1-4154-9E15-E0562233283E@.microsoft.com...
> > after windows updates/ie7 install on windows 2003 SP1 machine with SQL2000
> > SP4 buil 8.0.2039 we can no longer execute cscript from sql example:
> > ***********************
> > declare @.script varchar(8000)
> > set @.script = 'cscript.exe'
> > create table #output (
> > output varchar(8000)
> > )
> >
> > insert into #output
> > exec master.dbo.xp_cmdshell @.script
> >
> > select * from #output
> >
> > drop table #output
> > ***********************
> > returns NULL
> >
> > Any ideas?
>
>

cscript execution problems after windows updates/ie7 install

after windows updates/ie7 install on windows 2003 SP1 machine with SQL2000
SP4 buil 8.0.2039 we can no longer execute cscript from sql example:
***********************
declare @.script varchar(8000)
set @.script = 'cscript.exe'
create table #output (
output varchar(8000)
)
insert into #output
exec master.dbo.xp_cmdshell @.script
select * from #output
drop table #output
***********************
returns NULL
Any ideas?George - did you figure the answer out? I am having a very similar problem -
I used to run a VBS file that lives on a remote server with cscript through
XP_CMDSHELL, and suddenly I am getting "Access is Denied". See the thread in
this group:
Access is Denied when accessing files on remote server thru XP_CMDSHELL (was
working last week)
"George" <George@.discussions.microsoft.com> wrote in message
news:6893962E-3AB1-4154-9E15-E0562233283E@.microsoft.com...
> after windows updates/ie7 install on windows 2003 SP1 machine with SQL2000
> SP4 buil 8.0.2039 we can no longer execute cscript from sql example:
> ***********************
> declare @.script varchar(8000)
> set @.script = 'cscript.exe'
> create table #output (
> output varchar(8000)
> )
> insert into #output
> exec master.dbo.xp_cmdshell @.script
> select * from #output
> drop table #output
> ***********************
> returns NULL
> Any ideas?|||my error was slightly different and I tried all sorts of things from checkin
g
the nessessary permissions for sql service accounts to proxy accounts etc. a
t
the end I ended up manually uninstalling one by one all microsoft patches I
installed that caused this and it fixed it!
check that the service account sql is running under has permission for the
following:
NTFS for C:\Program Files\Microsoft SQL Server\MSSQL
Read and write for registry keys at and under:
HKEY_LOCAL_MACHINE\Software\Microsoft\MS
SQLServer
HKEY_LOCAL_MACHINE\System\CurrentControl
set\Services\MSSQLServer
HKEY_LOCAL_MACHINE\Software\Microsoft\Wi
ndows NT\CurrentVersion\Perflib
HKEY_LOCAL_MACHINE\Software\Clients\Mail
User Rights:
Act as Part of the Operating System = SeTcbPrivilege
Bypass Traverse Checking = SeChangeNotify
Lock Pages In Memory = SeLockMemory
Log on as a Batch Job = SeBatchLogonRight
Log on as a Service = SeServiceLogonRight
Replace a Process Level Token = SeAssignPrimaryTokenPrivilege
good luck
"Laurence Neville" wrote:

> George - did you figure the answer out? I am having a very similar problem
-
> I used to run a VBS file that lives on a remote server with cscript throug
h
> XP_CMDSHELL, and suddenly I am getting "Access is Denied". See the thread
in
> this group:
> Access is Denied when accessing files on remote server thru XP_CMDSHELL (w
as
> working last week)
>
>
> "George" <George@.discussions.microsoft.com> wrote in message
> news:6893962E-3AB1-4154-9E15-E0562233283E@.microsoft.com...
>
>