[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 223
  • Last Modified:

Running an exe from a Windows service before logging on

Hi,

Background:
I am looking into building a Windows service (with which I have very little experience).
The service will need to contain code to:
1. call an external script/exe, ie: "C:\Myprogram\myscript.exe"
2. read (but not write) from the registry.
3. write an update to a log file, ie: "C:\Myprogram\mylog.txt"

My question is:
If the computer is rebooted but nobody logs on and the machine is sitting on the login box (CTRL+ALT+DEL), will my service still be able to perform the 3 tasks above?
It may seem obvious, but I am concerned about how the system will know that my service has permission to read/write files and access the Registry.

Will it "just do it", or do I need to somehow program the service to have administrative permissions?

Many thanks,
GjOK
0
gjok
Asked:
gjok
  • 2
  • 2
1 Solution
 
jkrCommented:
>>If the computer is rebooted but nobody logs on and the machine is sitting on the login box (CTRL+ALT+DEL), will my
>>service still be able to perform the 3 tasks above?

Yes. Unless you want to read from HKEY_CURRENT_USER, of course.
0
 
gjokAuthor Commented:
But how will the system will know that my service has permission to read/write files ?
Does a service (by default) have administrative permissions?
0
 
jkrCommented:
A service runs under LocalSystem, which has almost Admin privileges, except network access. Writing to local files is not a problem at all.

BTW, be sure to check out http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndllpro/html/msdn_ntservic.asp ("Creating a Simple Win32 Service in C++")
0
 
gjokAuthor Commented:
Many thanks for your help.

Regards,
GjOK
0
 
AxterCommented:
FYI:
If your path is in a mapped drive, your service will have problems access the file(s).
This is the case, even if your mapped drive is mapped to your computer.

As long as you're using the C: drive directy, you shouldn't have any problems.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now