Solved

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

Posted on 2009-04-15
2
691 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

717 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