Windows Server 2003 - Running a service as a Local System account.

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Mike M. (nospam_at_someplace.com)
Date: 09/08/04


Date: Wed, 8 Sep 2004 13:35:48 -0400

I have a service that was written in VC 6.0 under Windows Server 2003. It
has a GUI and an icon that I place in the task tray. Double clicking the
icon displays the GUI. The service is set to start automatically and run
24x7. I had to add a feature to the service to periodically copy files from
another machine for failover purposes. Unfortunately it cannot access the
other machine while running as a Local System account and will not "allow
interact with desktop" if running as a specific user account. I know a
service with a GUI is not ideal but before I spend the time (which I don't
have) to decouple those parts, is there a method I could run a batch file or
process as a specified User and achieve my goals?

I have tried the following but can't get the CreateProcessWithLogonW to
succeed with correct values:
 // load the administrator profile
 DWORD dwLogonFlags = LOGON_WITH_PROFILE;

 PROCESS_INFORMATION ProcessInfo;
 STARTUPINFOW StartupInfo = {0};
 StartupInfo.cb = sizeof(STARTUPINFOW);
 StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
 StartupInfo.wShowWindow = SW_SHOWNORMAL;

 // go do it!
 if (!CreateProcessWithLogonW((LPCWSTR)wszAdminName,
  (LPCWSTR)wszDomain, (LPCWSTR)wszPassword, dwLogonFlags,
  (LPCWSTR)wszApplicationName, (LPWSTR)wszCommandline, 0, NULL, NULL,
  &StartupInfo, &ProcessInfo))

TIA.



Relevant Pages

  • Re: Im in over my head on this one. Clarification please...
    ... I recommend that you do not use your UI elements as state variables ... (don't use your GUI controls to be the difinitive holder of important ... appropriate icon on your status bar. ... Your GUI elements should be changed as a side effect of setting your ...
    (microsoft.public.vstudio.development)
  • Re: Windows Server 2003 - Running a service as a Local System account.
    ... > set the thread context back to the local system when you are done. ... >> has a GUI and an icon that I place in the task tray. ... >> process as a specified User and achieve my goals? ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Win98 -- all kidding aside
    ... Insert floppy. ... Then click either on the icon that appears there saying 1.5 MB Media, ... you won't need to do that since nautilus opens it automatically on ... at least, I can't do those things from within the GUI, which is what I ...
    (Ubuntu)
  • Re: [opensuse] Changing The Icon Size In The Kickoff Menu
    ... style menu icon size to something more reasonable than huge. ... The old KDE menu style keeps on screen the whole tree. ... The GUI is introduced as a help to reduce memorizing of file/application ... what would be good mail list to talk again about kickoff. ...
    (SuSE)
  • Re: BlackIce firewall from ISS - Is it a POS?
    ... month ago she started having troubles. ... I checked the performance graph in Task Manager and the CPU usage was spiking from a few percent to 50%, up and down like a yoyo when the system was idle. ... I've discovered that she can still use it although if the GUI is loaded the spiking returns. ... Right-click on the icon and choose 'exit' and the spiking stops. ...
    (comp.security.firewalls)