Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2009-04-15
2
Medium Priority
?
722 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 2000 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 2000 total points
ID: 24147273
Process..::.Start Method (String, String, SecureString, String)
http://msdn.microsoft.com/en-us/library/sxf2saat.aspx
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

596 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