.NET

Reply
*James Maeding
Post 1 of 4

run process as another user?

58 Views, 3 Replies
12-20-2006 02:05 PM
I just noticed when issuing a system.diagnostics.process.start method that you can tell it the prog name, then a
username and password!
Does this mean I can finally build into my programs, the ability to run a prog as an admin while my users are logged on?
This would be so stinking handy, anyone tried it?
thx
James Maeding
Civil Engineer and Programmer
jmaeding - athunsaker - com
*Norman Yuan
Post 2 of 4

Re: run process as another user?

12-20-2006 02:38 PM in reply to: *James Maeding
Yes, you can have your program start another app/process to "RunAs" admin,
as long as you supply the password.

However, you wouldn't want to hard code the password, would you? If you hide
the username/password somewhere, you'd need to make sure it is absolutely
safe, also you have to handle the situation when password is changed,
expired...

The usual approach would be, prior to call Process.Start(), you show a login
dialog to allow user to enter username/password. So, you do not need to hide
username/password somewhere. Only users who are the designated user or kow
the username/password will be able to proceed. This is equivalent to
right-click an exe program in Windows Expelorer and then select "Run as...".


"James Maeding" wrote in message
news:5432182@discussion.autodesk.com...
I just noticed when issuing a system.diagnostics.process.start method that
you can tell it the prog name, then a
username and password!
Does this mean I can finally build into my programs, the ability to run a
prog as an admin while my users are logged on?
This would be so stinking handy, anyone tried it?
thx
James Maeding
Civil Engineer and Programmer
jmaeding - athunsaker - com
*James Maeding
Post 3 of 4

Re: run process as another user?

12-20-2006 03:32 PM in reply to: *James Maeding
interesting, I thought I had tried the run as.. before but maybe I need to look again.
thanks

Norman Yuan
|>Yes, you can have your program start another app/process to "RunAs" admin,
|>as long as you supply the password.
|>
|>However, you wouldn't want to hard code the password, would you? If you hide
|>the username/password somewhere, you'd need to make sure it is absolutely
|>safe, also you have to handle the situation when password is changed,
|>expired...
|>
|>The usual approach would be, prior to call Process.Start(), you show a login
|>dialog to allow user to enter username/password. So, you do not need to hide
|>username/password somewhere. Only users who are the designated user or kow
|>the username/password will be able to proceed. This is equivalent to
|>right-click an exe program in Windows Expelorer and then select "Run as...".
|>
|>
|>"James Maeding" wrote in message
|>news:5432182@discussion.autodesk.com...
|>I just noticed when issuing a system.diagnostics.process.start method that
|>you can tell it the prog name, then a
|>username and password!
|>Does this mean I can finally build into my programs, the ability to run a
|>prog as an admin while my users are logged on?
|>This would be so stinking handy, anyone tried it?
|>thx
|>James Maeding
|>Civil Engineer and Programmer
|>jmaeding - athunsaker - com
James Maeding
Civil Engineer and Programmer
jmaeding - athunsaker - com
*J. Daniel Smith
Post 4 of 4

Re: run process as another user?

12-21-2006 08:05 AM in reply to: *James Maeding
I don't know what this has to do with AutoCAD .NET development, but...

Attached is a managed wrapper around the Windows "password" dialog which
makes getting the password from the user reasonably secure. Note that the
"password" parameter is a SecureString (new in .NET 2.0), this class goes to
some lengths to keep you from doing the "wrong thing" with a password.

Dan

"Norman Yuan" wrote in message
news:5432279@discussion.autodesk.com...
Yes, you can have your program start another app/process to "RunAs" admin,
as long as you supply the password.

However, you wouldn't want to hard code the password, would you? If you hide
the username/password somewhere, you'd need to make sure it is absolutely
safe, also you have to handle the situation when password is changed,
expired...

The usual approach would be, prior to call Process.Start(), you show a login
dialog to allow user to enter username/password. So, you do not need to hide
username/password somewhere. Only users who are the designated user or kow
the username/password will be able to proceed. This is equivalent to
right-click an exe program in Windows Expelorer and then select "Run as...".


"James Maeding" wrote in message
news:5432182@discussion.autodesk.com...
I just noticed when issuing a system.diagnostics.process.start method that
you can tell it the prog name, then a
username and password!
Does this mean I can finally build into my programs, the ability to run a
prog as an admin while my users are logged on?
This would be so stinking handy, anyone tried it?
thx
James Maeding
Civil Engineer and Programmer
jmaeding - athunsaker - com
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post