Starting a process with credentials from a Windows Service

后端 未结 8 1583
情话喂你
情话喂你 2020-11-27 05:42

I have a Windows service that runs as mydomain\\userA. I want to be able to run arbitrary .exes from the service. Normally, I use Process.Start() and it works fine, but in s

8条回答
  •  旧巷少年郎
    2020-11-27 06:20

    It may be that any process kicked off by a service must also have the "Log on as a Service" privelege.

    If the user id that you are using to start the second process does not have administrative rights to the box, this could be the case.

    An easy test would be to change the local security policy to give the userid "Log on as a service" and try it again.

    Edit: After the additional info..

    Grazing over Google on this one, it appears that 0xc0000142 relates to not being able to initialize a needed DLL. Is there something that the service has open that the spawned process needs? In any case, it looks like it has to do with the process that's kicked off, and not how you are doing it.

提交回复
热议问题