We help IT Professionals succeed at work.

Windows services

452 Views
Last Modified: 2013-12-17
Is there a way to create a windows service to run as any user rather than the SYSTEM?
-->
1) I created a C#.net service application to do something.
2) For testing purposes i used the command:: sc create serviceName binPath="...." start= "auto" depend= "Tcpip"
-->
When I look at Windows Task Manager. The process owner(User Name) that is associate with this service is "SYSTEM". I want this service to run as the local user but not restricted to this. If another user logs in I want his name listed as the username of this service.

Is there a way to do this?
Comment
Watch Question

DonNetwork Administrator
CERTIFIED EXPERT

Commented:
Services will only run as the user they were initially configured with, what is the reason you need this to run as the locally logged on user?

We should be able to find a workaround/other option for this.

Commented:
Why not run it as an application and place it in the startup dir or add it to the registry - this way it will always start when someone logs on, and as the logged on user.
Unless it is performing stuff at startup of windows this should work...

Author

Commented:
I am trying to automate printing. I can print to any physical printer but when I try to print to like Cutepdf or doPdf the print job gets stuck in the print queue. I was thinking that it is because the owner of the print job is "SYSTEM" rather than the local user. I can run it as regular application just fine but I need it as a service because if the application for some reason die I want it to start it up again. And windows service manager handles that.

Commented:
Why not create a user in the domain for this service - if it is hanging in the queue do to the credentials - this would allow access for printing and running on the local machines as needed.

Author

Commented:
I dont want to do that because the "System" account is a level above Administrator and I dont want anyone to have administrator rights besides myself or any other admins.

Commented:
Do you have an UnhandledException handler in your service?

Author

Commented:
no, I did not get an exception.
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.