473,385 Members | 1,622 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.

Strange behaviour with ProcessStart

Hi,

I notice some strange behaviour with Process.start; when I start an
mmc-console,
e.g. Process.Start("c:\\tools\\AdminConsole.msc"); everything works
fine, but when I try to start it with the following code (using a
username and password) I get "The specified executable is not a valid
Win32 application".

ProcessStartInfo myProcess = new ProcessStartInfo("AdminConsole.msc");
myProcess.UserName = strUserName;
myProcess.Password = password;
myProcess.Domain = "<domain>";
myProcess.FileName = "AdminConsole.msc";
myProcess.UseShellExecute = false;
Process.Start(myProcess);

Anyone any idea?

Greetings,

Mario

Jul 4 '07 #1
4 5149
As a complete guess - can you pass it a username and password on the command
line? If not that might be where your problem lies.

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog
<mc*********@interpolis.nlwrote in message
news:11**********************@m36g2000hse.googlegr oups.com...
Hi,

I notice some strange behaviour with Process.start; when I start an
mmc-console,
e.g. Process.Start("c:\\tools\\AdminConsole.msc"); everything works
fine, but when I try to start it with the following code (using a
username and password) I get "The specified executable is not a valid
Win32 application".

ProcessStartInfo myProcess = new ProcessStartInfo("AdminConsole.msc");
myProcess.UserName = strUserName;
myProcess.Password = password;
myProcess.Domain = "<domain>";
myProcess.FileName = "AdminConsole.msc";
myProcess.UseShellExecute = false;
Process.Start(myProcess);

Anyone any idea?

Greetings,

Mario

Jul 4 '07 #2
On Jul 4, 9:03 am, mcw.will...@interpolis.nl wrote:
Hi,

I notice some strange behaviour with Process.start; when I start an
mmc-console,
e.g. Process.Start("c:\\tools\\AdminConsole.msc"); everything works
fine, but when I try to start it with the following code (using a
username and password) I get "The specified executable is not a valid
Win32 application".
<snip>
myProcess.UseShellExecute = false;
This line is your problem.

Change it to true instead, and it'll be fine.

Jon

Jul 4 '07 #3
<mc*********@interpolis.nlwrote in message
news:11**********************@m36g2000hse.googlegr oups.com...
Hi,

I notice some strange behaviour with Process.start; when I start an
mmc-console,
e.g. Process.Start("c:\\tools\\AdminConsole.msc"); everything works
fine, but when I try to start it with the following code (using a
username and password) I get "The specified executable is not a valid
Win32 application".

ProcessStartInfo myProcess = new ProcessStartInfo("AdminConsole.msc");
myProcess.UserName = strUserName;
myProcess.Password = password;
myProcess.Domain = "<domain>";
myProcess.FileName = "AdminConsole.msc";
myProcess.UseShellExecute = false;
Process.Start(myProcess);

Anyone any idea?

Greetings,

Mario

Make it:

myProcess.FileName = "mmc.exe";
myProcess.Arguments = "c:\\tools\\AdminConsole.msc";

Willy.

Jul 4 '07 #4
On Jul 4, 10:39 am, "Willy Denoyette [MVP]"
<willy.denoye...@telenet.bewrote:
<mcw.will...@interpolis.nlwrote in message

news:11**********************@m36g2000hse.googlegr oups.com...


Hi,
I notice some strange behaviour with Process.start; when I start an
mmc-console,
e.g. Process.Start("c:\\tools\\AdminConsole.msc"); everything works
fine, but when I try to start it with the following code (using a
username and password) I get "The specified executable is not a valid
Win32 application".
ProcessStartInfo myProcess = new ProcessStartInfo("AdminConsole.msc");
myProcess.UserName = strUserName;
myProcess.Password = password;
myProcess.Domain = "<domain>";
myProcess.FileName = "AdminConsole.msc";
myProcess.UseShellExecute = false;
Process.Start(myProcess);
Anyone any idea?
Greetings,
Mario

Make it:

myProcess.FileName = "mmc.exe";
myProcess.Arguments = "c:\\tools\\AdminConsole.msc";

Willy.- Hide quoted text -

- Show quoted text -
Willy,

that did the trick! I had to pass the msc as an argument, I didn't
know that.

Thanks,

Mario

Jul 4 '07 #5

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

Similar topics

0
by: Frank Passek | last post by:
Dear all, I've encountered some strange behaviour with PHP (4.3.2) using the CLI-API. When I provide an option in the first line of my script like so: #!/usr/bin/php -c /path_to_my_ini_file and...
2
by: Paul Drummond | last post by:
Hi all, I am developing software for Linux Redhat9 and I have noticed some very strange behaviour when throwing exceptions within a shared library. All our exceptions are derived from...
3
by: Bruno van Dooren | last post by:
Hi All, i have some (3) different weird pointer problems that have me stumped. i suspect that the compiler behavior is correct because gcc shows the same results. ...
3
by: Sebastian C. | last post by:
Hello everybody Since I upgraded my Office XP Professional to SP3 I got strange behaviour. Pieces of code which works for 3 years now are suddenly stop to work properly. I have Office XP...
6
by: Edd Dawson | last post by:
Hi. I have a strange problem involving the passing of command line arguments to a C program I'm writing. I tried posting this in comp.programming yesterday but someone kindly suggested that I'd...
31
by: DeltaOne | last post by:
#include<stdio.h> typedef struct test{ int i; int j; }test; main(){ test var; var.i=10; var.j=20;
4
by: Gotch | last post by:
Hi, I'm getting a very strange behaviour while running a project I've done.... Let's expose it: I've two projects. Both of them use a Form to do some Gui stuff. Other threads pack up messages...
8
by: Dox33 | last post by:
I ran into a very strange behaviour of raw_input(). I hope somebody can tell me how to fix this. (Or is this a problem in the python source?) I will explain the problem by using 3 examples....
20
by: Pilcrow | last post by:
This behavior seems very strange to me, but I imagine that someone will be able to 'explain' it in terms of the famous C standard. -------------------- code -----------------------------------...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.