Solved

Is it possible to change process owner? "System.Diagnostics.Process"

Posted on 2009-04-15
2
679 Views
Last Modified: 2013-12-17
Hi,

I have a .net exe that is launched by a very limited user.
the user does this by clicking a batch file that uses runas to run the exe using the Admin account on the box.
so the exe is running as the Admin.

However i then call another bat file using System.Diagnostics.Process from within code that basically consists of an Xcopy from a server share.
Because the exe is running as the Admin the batch files fails because you have to be a member of a group to access the share.
the logged on user is a member and can access the share but not via the exe, presumebaly because the exe is running under Admin account.
is it possible to run the xcopy batch file under the logged on user account?

cheers

0
Comment
Question by:caoimhincryan
  • 2
2 Comments
 
LVL 53

Accepted Solution

by:
Dhaest earned 500 total points
ID: 24147261
Runas.exe doesn't let you specify the password on the command line.  
In .NET 2.0, Process.Start() does have an overload that allows specifying the user and password.

System.Diagnostics.Process, RunAs and hidden windows
http://tourist.spaces.live.com/blog/cns!851D2B32CC1B64B4!573.entry?sa=460302768
0
 
LVL 53

Assisted Solution

by:Dhaest
Dhaest earned 500 total points
ID: 24147273
Process..::.Start Method (String, String, SecureString, String)
http://msdn.microsoft.com/en-us/library/sxf2saat.aspx
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now