473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

[.NET 2.0] Process / ProcessStartInfo with specified account

I am trying to run an external process (command tool) within a Windows
Service with the specified account. When the application launches I get
a error dialog with the following message:

Application popup: <COMMAND TOOL> - Application Error : The application
failed to initialize properly (0xc0000142). Click on OK to terminate
the application.

I use the following code to start the process (not relevant code is
stripped):

using (Process commandTool = new Process())
{
ProcessStartInfo startInfo = commandTool.StartInfo;
startInfo.FileName = commandToolPath;
startInfo.Arguments = arguments;
startInfo.UseShellExecute = false;
startInfo.RedirectStandardError = true;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardInput = true;
startInfo.CreateNoWindow = true;
startInfo.Domain = domain;
startInfo.UserName = username;
startInfo.Password = password;

commandTool.Start(); // -> Fails here with error dialog!

if (!commandTool.HasExited)
{
int timeout = this.configuration.QuotaCommandToolTimeout;

if (timeout > 0)
{
commandTool.WaitForExit(timeout); // With configured timeout
}
else
{
commandTool.WaitForExit(); // Without timeout
}
}

string errorOutput = commandTool.StandardError.ReadToEnd();
string infoOutput = commandTool.StandardOutput.ReadToEnd();
}

When starting the process without the account information it starts
fine only it doesn't work, as I need a domain service account.

Anybody has a idea how to solve this?

May 24 '06 #1
2 6423

"Alexander van Doormalen" <av*********@gmail.com> wrote in message
news:11**********************@y43g2000cwc.googlegr oups.com...
|I am trying to run an external process (command tool) within a Windows
| Service with the specified account. When the application launches I get
| a error dialog with the following message:
|
| Application popup: <COMMAND TOOL> - Application Error : The application
| failed to initialize properly (0xc0000142). Click on OK to terminate
| the application.
|
| I use the following code to start the process (not relevant code is
| stripped):
|
| using (Process commandTool = new Process())
| {
| ProcessStartInfo startInfo = commandTool.StartInfo;
| startInfo.FileName = commandToolPath;
| startInfo.Arguments = arguments;
| startInfo.UseShellExecute = false;
| startInfo.RedirectStandardError = true;
| startInfo.RedirectStandardOutput = true;
| startInfo.RedirectStandardInput = true;
| startInfo.CreateNoWindow = true;
| startInfo.Domain = domain;
| startInfo.UserName = username;
| startInfo.Password = password;
|
| commandTool.Start(); // -> Fails here with error dialog!
|
| if (!commandTool.HasExited)
| {
| int timeout = this.configuration.QuotaCommandToolTimeout;
|
| if (timeout > 0)
| {
| commandTool.WaitForExit(timeout); // With configured timeout
| }
| else
| {
| commandTool.WaitForExit(); // Without timeout
| }
| }
|
| string errorOutput = commandTool.StandardError.ReadToEnd();
| string infoOutput = commandTool.StandardOutput.ReadToEnd();
| }
|
| When starting the process without the account information it starts
| fine only it doesn't work, as I need a domain service account.
|
| Anybody has a idea how to solve this?
|

If you are running the service in a SYSTEM logon session on XP SP2 or W2K3,
you'll need to run your service on another account (LocalService or
NetworkService f.i). Both W2K3 and XP SP2 don't allow you to spawn another
process with alternate credentials when launched from the SYSTEM logon
session.

Willy.
Willy.

May 24 '06 #2
The service runs with its own service account which is required by the
software vendor.

May 24 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: toby | last post by:
Can any one help? I'm trying to use System.Diagnostics.Process.Start to open legacy MS access aplications (ade and mdb files) and vb 6 .exe's using asp.net. There is something confusing going on?!?...
0
by: Leo Heska | last post by:
Hi I haven't seen the following problem mentioned anywhere We have an application written in VB.NET which executes a batch file (named startJob.cmd). We have discovered that if that batch file...
3
by: Philip Wagenaar | last post by:
Framework 1.1 I want to start AcrobatReader to print a printjob under a specific username (so that the owner of the printjob is not the username of the application that the .net application runs...
11
by: Kirk | last post by:
The following C# web service works fine until you uncomment the lines setting UserName and Password. Then the process starts as the specified user, but hangs in a suspended state. In fact, any...
0
by: Kirk | last post by:
The following C# web service works fine until you uncomment the lines setting UserName and Password. Then, Process.Start throws an Access is Denied Exception. This is with .NET 2.0, of course...
7
by: John.NET | last post by:
Hi, First please forgive that this is a repost as the first time I didn't have my proper nospam email configured... I'm writing a web service where one method will launch another .NET program...
3
by: DBC User | last post by:
In my c# program I need to call an old legacy program for doing data conversion. For that I have written a code like this follows Process proc = new Process(); proc.StartInfo.CreateNoWindow =...
1
by: porsch55 | last post by:
m_oProc = new Process(); ProcessStartInfo oInfo; oInfo = new ProcessStartInfo("\\\\" + sSourceServer + "\\" + Environment.SystemDirectory.Replace("C:", "C$") + "\\psexec.exe", " \...
0
by: starrysky | last post by:
I have a process (A) that runs at user login on many systems. The users are usually not Administrators. I want the process to be able to launch a process (B) to do Admin level tasks. I have a common...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.