Running an.exe from an.asp documents making use of wscipt under Windows Server 2003

[This was initially uploaded at yet could be preferable below and also I'm certain it's a web server arrangement concern. Apologies if this is taken into consideration negative kind.]

As component of our data source alteration control (and also auto-installation) treatments we require to be able run sqlcmd.exe on various.sql files from within an ASP web page. The code I'm making use of to do this is:

Dim cmd : cmd = "sqlcmd -S " & DATABASE_SERVER & " -U " & DATABASE_UID & " -P " & DATABASE_PWD & " -d " & DATABASE_NAME & " -i """ & scriptPath & """ -b"
Dim wshShell : Set wshShell = Server.CreateObject("WScript.Shell")
Dim return : return = wshShell.Run(cmd, 0, True)

I have the code functioning penalty on 2 different growth equipments. These are both running XP and also called for no in addition actions to get the code working. Having actually released the code to a Windows 2003 web server it's having troubles. The trouble being that the value for return is constantly 1. This additionally takes place if I attempt to get it to run a set documents or anything else I can consider (if I transform the value for cmd to an non-existing documents it bombs out as I would certainly anticipate)

I've attempted including I_USR and also I_WAM to have execute approvals on both sqlcmd.exe and also cmd.exe yet it still returns 1. If I open a command punctual at the web server and also do a "runas/ customer:servername \ i_usr sqlcmd.exe" that functions penalty yet ranging from the ASP web page still does not function.

Additionally, when running the.sql manuscripts by hand every little thing runs efficiently so there's no worry with them.

Exist any kind of security setups on the web server that I've neglected to transform within IIS or Windows usually to make it function?

I have actually additionally attempted this on an additional Server 2003 equipment and also am obtaining specifically the very same trouble.


2019-05-04 12:35:52
Source Share
Answers: 1

Have simply figured out what the trouble was (well, my organizing carrier did). Transformed code by including '% COMSPEC%/ C' (where %COMSPEC% holds the course to cmd.exe) to the front of the command.

Dim cmd : cmd = "%COMSPEC% /C sqlcmd -S " & DATABASE_SERVER & " -U " & DATABASE_UID & " -P " & DATABASE_PWD & " -d " & DATABASE_NAME & " -i """ & scriptPath & """ -b"

It currently functions simply dandy. I'm not exactly sure concerning the whys/hows so I'll leave the inquiry unanswered in the meantime for a person to address even more adequately if they can.

2019-05-09 03:02:24