Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8010795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:50:47+00:00 2026-06-04T18:50:47+00:00

First off, I’m not trying to interact with the desktop in any kind. What

  • 0

First off, I’m not trying to interact with the desktop in any kind.

What I’m trying to do is to separate concerns. I have a service that runs under the local system account (LSA). Sometimes, I need to execute processes under a different account.

I am using System.Diagnostics.Process for this. This is what I have tried with so far:

  • Running the service app as an ordinary desktop app, launching the child process under the same account: works
  • Running the service app as an ordinary desktop app, launching the child process under another account: works
  • Running the service as a service app (as LSA), launching the child process under the same account (LSA): works
  • Running the service as a service app (as LSA), launching the child process under another account: does not work

The case that does not work for me throws me a Win32Exception with “Access denied.” I have granted the user account in question the right to log on as a service, but it does not make any difference.

For fun, I have also tried these scenarios:

  • If I run the service under my own dev account (let’s call it Developer), and tries to start the child process under the less privileged account (let’s call it ServiceAccount), process.Start() does not throw, and returns true, but I never see any process being started in the Sys Internal’s Process Explorer, and Process.Exited is fired immediately.
  • If I run the service under ServiceAccount, and starts the child process under the same account (ServiceAccount), it works as expected.

This is the code I’m working with:

var pi = new ProcessStartInfo {
    CreateNoWindow = true,
    WindowStyle = ProcessWindowStyle.Hidden,
    UseShellExecute = false,
    ErrorDialog = false,
    RedirectStandardError = false,
    RedirectStandardInput = false,
    RedirectStandardOutput = false,
    FileName = @"C:\Path\To\SomeApplication.exe",
    Arguments = @"Some arguments",
    UserName = "SomeUserName",
    Domain = "SomeDomain",
    Password = SecureStringUtils.Convert("SomePassword")
};

var process = new Process();
process.StartInfo = pi;
process.Start(); // Throws when run as a service

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T18:50:48+00:00Added an answer on June 4, 2026 at 6:50 pm

    I finally found this: Using Process.Start() to start a process as a different user from within a Windows Service, and it solves my problem. Granted, the code provided in the answer needs a ton of polishing, but it does seem to fix my problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First off I have an app that provides the user information about the amount
First off, I'm using Access 2000 and DAO. I have code that executes a
First off, let me start off that I am not a .net developer. The
First off, I have never used VBA (or VB for that matter), so keep
First off, I would like to make clear, that I am SUPER NEW TO
First off, I've never used GWT before. I have good experience in HTML/CSS/JS/JSP. I'm
First off, I'm not terribly experienced in XML. I know the very basics of
First off, I'm not a math guy, so large number precision rarely filters into
First off, I will say i've spent 6 hours on this topic and have
First off I am pretty new to C, so I probably just have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.