473,394 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to start Process Under windows User.

dj12345
14
Hi,

Can anybody solve my problem.

I have one small windows Application. In this application i have added Installer Class. which start a program after the setup project installation is completed.

Expand|Select|Wrap|Line Numbers
  1.   private void Installer1_AfterInstall(object sender, InstallEventArgs e)
  2.         {
  3.  
  4.  
  5.         Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
  6.                 Process p = new Process();
  7.                 InstallContext cont = this.Context;
  8.                 //ProcessStartInfo inf = new ProcessStartInfo(cont.Parameters["assemblypath"]);
  9.                 p.StartInfo.FileName = (cont.Parameters["assemblypath"]);
  10.                 p.StartInfo.UseShellExecute = false;
  11.                 p.StartInfo.LoadUserProfile = true;
  12.                 p.Start();
  13.  
  14. }
when setup is completed it starts the program. but the problem is it starts the under the user "NT AUTHORITY\SYSTEM", I want to start this program under the user which is logged in (User Logged in user windows authentication).
Feb 15 '10 #1
8 6796
tlhintoq
3,525 Expert 2GB
TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.
Feb 15 '10 #2
tlhintoq
3,525 Expert 2GB
Installing a secondary program after the first program installs. Looks like a virus to me.
Feb 15 '10 #3
sashi
1,754 Expert 1GB
What if the currently logged user doesn't have Administrator access? How are you going to deal with this? My advice will be starting the service with "Local User Account"

Good luck :)
Feb 15 '10 #4
dj12345
14
Hi Sashi..

Thanks for your reply.

Actually I dont want to create a service.. I am creating a Setup & Deployement project. When user install the setup then after completing the installation the program which is just installed should start immediately.

So in this Setup project i am adding Custome Action. In this the installer after install will start the actual program. so I am starting the program using Process.Start(). But it starts under "NT AUTHORITY\SYSTEM" . I want to start this program under the user which is logged in (User Logged in user windows authentication).

Hope you have understood my problem..

Thank you...
Feb 16 '10 #5
sashi
1,754 Expert 1GB
Why not post your code segment here? Lets see how it can be modified. Take care :)
Feb 16 '10 #6
I am having the exact same problem, did you ever figure this out?
Aug 13 '10 #7
dj12345
14
Hi pconno,

The Setup & Deployment project was not working for me.. Creating setup project using Visual Studio 2005 was only working under windows xp and not under windows 7. So finally I used "Inno Setup" application to create setup. and this works under xp and windows 7. creating setup project using "Inno Setup" solved my problem. It is free and you can easily create setup and you can also write some programing logic also. http://www.jrsoftware.org/isinfo.php
Aug 14 '10 #8
Thanks dj12345,
Inno seems to work perfectly for me too.
Aug 16 '10 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Dmitri Shvetsov | last post by:
Hi, Can I start an external process from the Web Service? I'm using a code, compiler keeps silence, compiles ok and starts the project. When I trace in Debugger it doesn't start an external...
12
by: GTi | last post by:
I have small program that always must be running when a user is logged on. Since users can close this program I must create a program that always check if this program is running. So I created a...
5
by: Dean Slindee | last post by:
I have looked everywhere I can think of for the .exe name of the Windows Picture and Fax Viewer. Anybody know what it's named? Thanks, Dean Slindee
3
by: Philip Wagenaar | last post by:
How can I get the output from a process.start. Example: Process.Start("c:\windows\system32\rp", PrintQueue & " " & filename, Username, pass, ComputerName) How do I get the output of this...
0
by: Kirk | last post by:
The following C# web service works fine until you uncomment the lines setting UserName and Password. Then, Process.Start throws an Access is Denied Exception. This is with .NET 2.0, of course...
4
by: Paul | last post by:
Hi, I am trying to start a process hidden. My code: wordprocess = new System.Diagnostics.Process(); ; wordprocess.StartInfo = new System.Diagnostics.ProcessStartInfo(wcmd, args);...
6
by: uuyytt | last post by:
I have a Windows service from which I want to start Internet Explorer with a particular URL as an argument. I don't know why my code (shown below) doesn't work. I know that IExplore.exe starts as I...
5
by: Reddy | last post by:
I am running process.sart to run gpg.exe to encrypt files. It's working fine with console application. When i use same code in windows service. It's not working. It's not even throwing...
3
by: illegal.prime | last post by:
Hi all, I have a service that needs to start a regular windows application. I'm running the service as ServiceAccount.LocalSystem. But, when it starts the process (using Process.Start) the GUI...
4
by: =?Utf-8?B?VkIgSm9ubmll?= | last post by:
I am at my witless end here, please help! I have an ASP.Net aspx web page, hosted on Windows Server 2003, that receives a query string with the path to an autocad drawing file selected from a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.