Service not able to access a mapped drive

mapped-driveprocesssecurity-contextwindows-services

I have read in many forums that mapped drives are not accessible from a service as no user is logged on.

Question 1) I tried making my service as a log on – as some account and i had my network drive mapped in that very account. The service still cannot access it. Why?

Question 2) From the same sevice, i invoke another process. Under what user account will the process run?

Thanks

Best Answer

1) Use UNC paths instead, then you do not need access to mapped drive letters. As to why you cannot access them even when running in the same account, it is hard to say for sure without seeing your actual code.

2) it depends on how you are launching the process. If you use ShellExecute() or CreateProcess(), then it runs in the user account of the calling thread. If you use CreateProcessAsUser(), CreateProcessWithLogonW(), or CreateProcessWithTokenW(), then it runs in the user account that you pass in.

Related Topic