Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Run batch files with impersonation

Reply
Thread Tools

Run batch files with impersonation

 
 
dd.squad@gmail.com
Guest
Posts: n/a
 
      08-24-2006
When creating a new process, the aspnet worker process always runs it
under the ASPNET user instead of the user that is being impersonated.
After some research, I got around this by invoking the
CreateProcessAsUser win api call. That works ok for executables, but
trying to run batch files gave me an Access is Denied return code (5).
This is apparently because creating a process from a .bat file actually
uses c:\windows\system32\cmd.exe. So I gave the impersonated user
account permission to run cmd.exe, but it still returns with
-1073741502 (0xC0000142 in hex) which has something to do with dll's
not initializing. Looks to me like cmd.exe may require access to some
system dll's that the impersonated user has no access to. If I don't
impersonate, and just let it run with the ASPNET user, it works. We
have a large number of batch files that really need to be run from
impersonated asp.net app. Does anyone have any insight into how to
make this work?

 
Reply With Quote
 
 
 
 
MikeS
Guest
Posts: n/a
 
      08-26-2006
Did you change the command being executed to be something like "cmd.exe
/c myJob.bat" ?

Also, since this is .NET forum not win32,

It looks like you can use a System.Diagnostics.Process and it's
StartInfo property to specifiy the credentials to run with.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Converting .py files to batch files. Matias Surdi Python 4 09-17-2008 06:07 PM
Re: Converting .py files to batch files. Chris Rebert Python 0 09-15-2008 06:30 PM
Problem with Impersonation to execute batch file via ASP.Net Elroyskimms ASP .Net 0 07-18-2006 04:34 AM
Run batch files in Windows XP erniedude@gmail.com Python 7 07-26-2005 04:23 AM
Can you run batch files in Windows XP? John S. NZ Computing 5 02-22-2004 02:39 AM



Advertisments