473,789 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Service running as [user] rather than [system]

Hi,

I have a service that need to access the current user registry from time to
time.
But a service only works as a SYSTEM and not as the current user.

How can i change that? Or at the very least get the service to launch an
application as the current user and not the SYSTEM

Many thanks

Sims
Jul 21 '05
15 2024
Unless you have a very specific requirement, use HKEY_LOCAL_MACH INE instead.

One of the ideas behind running a process under the SYSTEM account is that
it cannot do these types of things.
--
_______________ _____
Klaus H. Probst, MVP
http://www.vbbox.com/

"Sims" <si*********@ho tmail.com> wrote in message
news:u0******** ******@tk2msftn gp13.phx.gbl...
Hi,

I have a service that need to access the current user registry from time to time.
But a service only works as a SYSTEM and not as the current user.

How can i change that? Or at the very least get the service to launch an
application as the current user and not the SYSTEM

Many thanks

Sims

Jul 21 '05 #11
Unless you have a very specific requirement, use HKEY_LOCAL_MACH INE instead.
One of the ideas behind running a process under the SYSTEM account is that
it cannot do these types of things.


I agree, but my problem goes all the way back to installation.
The users cannot install the service, (they cannot install anything in
fact), only the administrator can, so what i wanted to do was to run the
install as an administrator and ensure that the service gets started as
current user.
Maybe if i use HKEY_LOCAL_MACH INE it will solve the problem to a certain
level.

That should apply to future users.
Maybe my problem is more to do with installations rather than services
themselves.

For example when i installed MS Word it was installed for all users, (new
and old).

Sims

Jul 21 '05 #12
A service can spawn a process with a currently logged on user credentials
(if that's what you want), without need to know those credentials.

To start a _service_ with user's credentials, the user also should have
"Logon as service" privilege, which you may not want to allow.

"Sims" <si*********@ho tmail.com> wrote in message
news:ey******** *****@tk2msftng p13.phx.gbl...
Unless you have a very specific requirement, use HKEY_LOCAL_MACH INE

instead.

One of the ideas behind running a process under the SYSTEM account is that it cannot do these types of things.


I agree, but my problem goes all the way back to installation.
The users cannot install the service, (they cannot install anything in
fact), only the administrator can, so what i wanted to do was to run the
install as an administrator and ensure that the service gets started as
current user.
Maybe if i use HKEY_LOCAL_MACH INE it will solve the problem to a certain
level.

That should apply to future users.
Maybe my problem is more to do with installations rather than services
themselves.

For example when i installed MS Word it was installed for all users, (new
and old).

Sims

Jul 21 '05 #13

"Alexander Grigoriev" <al***@earthlin k.net> wrote in message
news:O5******** ******@TK2MSFTN GP10.phx.gbl...
A service can spawn a process with a currently logged on user credentials
(if that's what you want), without need to know those credentials.
How would you do that then?

To start a _service_ with user's credentials, the user also should have
"Logon as service" privilege, which you may not want to allow.


Indeed.

Idealy the service would sprawn a process with the currently logged in user.

Thanks
Sims
Jul 21 '05 #14
You need to get a token for a currently logged on user. Then call
CreateProcessAs User
To get a token you may need to open the current window station in the
current terminal session, and quite a few more steps. I don't remember all
of that.

"Sims" <si*********@ho tmail.com> wrote in message
news:eB******** ******@TK2MSFTN GP10.phx.gbl...

"Alexander Grigoriev" <al***@earthlin k.net> wrote in message
news:O5******** ******@TK2MSFTN GP10.phx.gbl...
A service can spawn a process with a currently logged on user credentials (if that's what you want), without need to know those credentials.
How would you do that then?

To start a _service_ with user's credentials, the user also should have
"Logon as service" privilege, which you may not want to allow.


Indeed.

Idealy the service would sprawn a process with the currently logged in

user.
Thanks
Sims

Jul 21 '05 #15

"Sims" <si*********@ho tmail.com> wrote in message
news:ey******** *****@tk2msftng p13.phx.gbl...
Unless you have a very specific requirement, use HKEY_LOCAL_MACH INE

instead.

One of the ideas behind running a process under the SYSTEM account is that it cannot do these types of things.


I agree, but my problem goes all the way back to installation.
The users cannot install the service, (they cannot install anything in
fact), only the administrator can, so what i wanted to do was to run the
install as an administrator and ensure that the service gets started as
current user.


OK. But this is a separate problem - why not use MSI? It has built-in
support for that kind of thing. That's how you can install Office on a box
without requiring the user to be an admin.
--
_______________ _____
Klaus H. Probst, MVP
http://www.vbbox.com/

Jul 21 '05 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1523
by: mailme.faisal | last post by:
I have created a service that create a process. The service is running in local system account & it also create the new process in system account. In process i have to access network resource . In Windows 2000 new process is working fine but in Windows XP it does't do anything . The problem is that newly created problem could not access network path thats y creating problem . What may b the reason ?
3
3691
by: Doug Bailey | last post by:
I am trying to control a Windows Service via a Web Service interface. (I am developing in .NET2003) I am using the ServiceController object which allows me to read the state of the services with no problems. However, I am not able to start or stop the service unless I go through the process of impersonating an administrative user. (See MSDN KB 306158) Since it appears to be a privilege issue, I set the folders in IIS holding the Web...
5
2871
by: Andrew | last post by:
Hey all, Requesting help from the VB.Net gurus in here. I was given a task to write a Windows Service (VB.Net) that would run an external program, and if that program closed for any reason (other than the service being stopped) it would restart it. I have written the service to do just this, and for testing purposes I am running the program Notepad. And I even have it making entries in the System Event Log. However, and this is my...
15
350
by: Sims | last post by:
Hi, I have a service that need to access the current user registry from time to time. But a service only works as a SYSTEM and not as the current user. How can i change that? Or at the very least get the service to launch an application as the current user and not the SYSTEM Many thanks
17
6445
by: UJ | last post by:
Is there any way for a windows service to start a windows program ? I have a service that will need to restart a windows app if it needs to. TIA - Jeff.
2
6902
by: deko | last post by:
When to use a privileged user thread rather than a windows service? That's the question raised in a previous post . It was suggested that if the service needs to interact with a WinForms app (which is the UI used to adjust the actions taken by, and the schedule of the service), then a privileged user thread should be used in the UI - no service required. But... "A windows service enables the creation of long-running executable
8
2676
by: Rob R. Ainscough | last post by:
I have a VS 2005 Windows Service with a Installer project as part of my solution. The Service installs fine but I can't seem to make either of these work: 1. Have the service start after install 2. Have the service interact with the SysTray In my ProjectInstaller.vb Private Sub ServiceInstaller1_AfterInstall(ByVal sender As
33
11865
by: JamesB | last post by:
I am writing a service that monitors when a particular app is started. Works, but I need to get the user who is currently logged in, and of course Environment.UserName returns the service logon (NT_AUTHORITY\SYSTEM). I understand that when the service starts, no user may be logged in, but that's ok, as the app I am monitoring can only be run by a logged in user. Do I need to use WMI to get the user context of Explorer.exe or is there a...
2
5340
by: =?Utf-8?B?bXVyYWRqYW1lcw==?= | last post by:
Yes, sorry I tried to make it clear in the original question that I want to get the user token of the service - ie. the account the service is running under. I know services don't have user tokens - I suspect users do have tokens, hence "user token", otherwise we might call them "service tokens" or somesuch :-) If you read the question again, you migh see that the fundamental question is, *assuming there is no other approach*: The...
0
9663
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10404
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10195
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10136
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9016
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6765
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5415
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.