Click here to Skip to main content
15,867,834 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have deployed a windows service "ServiceName" at a client machine in UAT.The UAT system has been logged on remotely using "ABC" username and "XYZ" password. The service picks the request from DB to generate reports in pdf format and launches a PDFGeneration.exe.
In task manager the "ServiceName" is running under SYSTEM account. But when it launches the PDFGeneration.exe it gets launched under "ABC" user logged on. I want the PDFGeneration.exe to run under SYSTEM account.Since the PDFGeneration.exe is running under "ABC" account it fails to do some task which PDFGeneration.exe can do under SYSTEM account.
Need some urgent help if possible.
Thanks in advance guys!!!

What I have tried:

I have tried visiting links on codeproject.
One says that it's not possible.
Posted
Comments
Garth J Lancaster 13-Jul-16 20:45pm    
you dont make it clear how/why the PDFGeneration.exe runs under user 'ABC', or what permissions etc PDFGeneration.exe gets or needs running under SYSTEM account.

I would create a local account just for running PDFGeneration.exe, with the correct permissions, then use something like http://www.codeproject.com/Articles/10090/A-small-C-Class-for-impersonating-a-User to run PDFGeneration.exe as that user

Another approach is to create a local account with the correct permissions and run both the service and PDFGeneration.exe using that account's credentials - but, as I said early on, you havnt supplied information on 'how PDFGeneration.exe runs as user ABC', that would need to be investigated first, in order to change the user PDFGeneration.exe runs as to the 'service account'

I'm not sure one could impersonate 'SYSTEM' easily - something about obtaining the SID etc from a process already running as SYSTEM and using the SID to start the PDFGeneration.exe process comes to mind, but its a vague and possibly dangerous thought at best
Bernhard Hiller 14-Jul-16 5:23am    
How does that service launch PDFGeneration.exe? Is the PDFGEneration.exe actually launched by an application running in the context of ABC (perhaps even hidden in the System Tray) which communicates with your service? Or did you actually mix up account names when you wrote this question?
maverick1991 14-Jul-16 6:25am    
Thanks for the replies guys.
The issue was because of some rights on a particular folder which PDFGEneration.exe could not access under the account of "ABC".So, we have made the exe to access some other folder. I want the exe to run under SYSTEM account so that it has the same right as SYSTEM.But due to some rights privileges it was not able to access a particular folder.
Thanks again.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900