Re: Windows Server 2003 - Running a service as a Local System account.
From: Mike M. (nospam_at_someplace.com)
Date: 09/10/04
- Next message: Harry Potter: "Re: help me with my understanding of WSPRecv/From"
- Previous message: Mike: "GetSystemMetrics(SM_REMOTESESSION) and services"
- In reply to: Mike: "RE: Windows Server 2003 - Running a service as a Local System account."
- Next in thread: Mike M.: "Re: Windows Server 2003 - Running a service as a Local System account."
- Reply: Mike M.: "Re: Windows Server 2003 - Running a service as a Local System account."
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 10 Sep 2004 13:26:56 -0400
o.k Thanks. I'll give that a try.
"Mike" <Mike@discussions.microsoft.com> wrote in message
news:61AAC15E-488A-4853-AC60-5B5807F18B67@microsoft.com...
> If you have the username and password, just call LogonUser() and
> ImpersonateLoggedOnUser(). Then access your files. This will access the
> files as the user that you logged on. Then you can call RevertToSelf() to
> set the thread context back to the local system when you are done. Make
sure
> that you clean up these handles.
> -Mike
>
> "Mike M." wrote:
>
> > 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.
> >
> >
> >
- Next message: Harry Potter: "Re: help me with my understanding of WSPRecv/From"
- Previous message: Mike: "GetSystemMetrics(SM_REMOTESESSION) and services"
- In reply to: Mike: "RE: Windows Server 2003 - Running a service as a Local System account."
- Next in thread: Mike M.: "Re: Windows Server 2003 - Running a service as a Local System account."
- Reply: Mike M.: "Re: Windows Server 2003 - Running a service as a Local System account."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|