By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,117 Members | 2,093 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,117 IT Pros & Developers. It's quick & easy.

Issues with launching Batch files on Win2003 (not Win2000)

P: n/a
hi guys,

here is my problem:
i have to maintain a web application developped some times ago.
The application was developped on Windows2000 SP3 with Visual Studio
2003 (7.1).
and the application was running on windows 2000 SP3 with the usual IIS.
Right now i need to make it work, on a Windows 2003 SP1 server (but i
need the keep the dev environment on VisualStudio 2003).
this app need to run some batch file, unfortunately for me, on the
initial development instead of rely on the .NET1.1 references classe an
activex was use to run the batch files.
And as I fear this ActiveX doesn't exist on the win2003 OS, so i wrote
a quick launcher for batch file (as you can read below).
I test it under Win2000 OS, and it run fine giving the output of the
So i deployed the application on Win2003, the same way under
(well registering .NET 1.1, and allowing it via inetmgr , I also put
trace on,
from web.config file
<identity impersonate="true" />
<authentication mode="Windows" /></authentication>
<allow users="*" / <!-- Allow all users -->
<trace enabled="true" requestLimit="10" pageOutput="false"
traceMode="SortByTime" localOnly="false" />

Then i log on the web app using a user registered on the domain, And i
would really love if the batch could launch.
but unfortunately the launcher return nothing from the StandardOutput
from the process.start.
but no error, no exception. I also check in the eventviewer if there
would be some error raised (i was thinking about silent impersonation)
but unfortuntely i can't found anything...
As i wasn't sure about the impersonation I checked the url : , i implemented any
solution but i keep the same behaviour no error, and an empty result.

So if anybody could raise a solution from his hat it will really be

Thank you so much in advance.
Kind regards,


ps : well i just can't make any change on the OS configuration (it's
another team which is responsible for this and they won't go this way)
pps : i run the batch by hand with the same user, and it run fine.

from web.config file
<identity impersonate="true" />
<authentication mode="Windows" /></authentication>
<allow users="*" / <!-- Allow all users -->
<trace enabled="true" requestLimit="10" pageOutput="false"
traceMode="SortByTime" localOnly="false" />

here is my launcher :
Function executeLocalBatch(ByVal CommandeComplete As String, ByVal
LesArguments As String, ByVal TimeOutInSeconds As Int32, ByVal laTrace
As TraceContext) As String

Dim resultat As String = ""
Dim myProcess As Process = New Process
Dim sin As StreamWriter
Dim sout As StreamReader
Dim serr As StreamReader

myProcess.StartInfo.FileName = CommandeComplete
myProcess.StartInfo.Arguments = LesArguments
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.StartInfo.RedirectStandardError = True

sin = myProcess.StandardInput
sout = myProcess.StandardOutput
serr = myProcess.StandardError

myProcess.WaitForExit(TimeOutInSeconds * 1000)
resultat = sout.ReadToEnd()
resultat += "Erreur :[" + serr.ReadToEnd() + "]"

Catch ex As Exception
Dim error_msg As String = handleText_Exception(ex, "erreur
dans l'execution ")
resultat += error_msg
End Try
laTrace.Warn("exec seems ok")

If Not myProcess.HasExited Then
Throw New SystemException("Erreur : l'application " +
CommandeComplete + " ne s'est pas arreté normalement, son execution
s'est probablement mal passée")
End If
laTrace.Warn("exec the result is = [" + resultat + "]")
Return resultat
End Function

Jul 13 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.