.NET

Reply
*James Maeding
Message 1 of 4 (51 Views)

run process as another user?

51 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
Message 2 of 4 (51 Views)

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
Message 3 of 4 (51 Views)

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
Message 4 of 4 (51 Views)

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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community