Windows Service (using SRVANY) is not able to acces network drive
Hey, I made a simple C program to write a file on a mapped network drive (which is in fact a local directory which I shared and mapped to S:). When I run this program as a user it is able to create a file ( as expected ).
Hey,
I made a simple C program to write a file on a mapped network drive (which is in fact a local directory which I shared and mapped to S:). When I run this program as a user it is able to create a file ( as expected ). When I install the program as a service using srvinst.exe and srvany.exe it is no longer able to write on the mapped drive. When I try to write on the C: drive there is no problem. I tried several option to run the service with the administrator account but none was succesfull.
Does someone have a suggestion? Or an example how to write a windows service (using VC6.0) to avoid using srvany
Ron Bakker
I made a simple C program to write a file on a mapped network drive (which is in fact a local directory which I shared and mapped to S:). When I run this program as a user it is able to create a file ( as expected ). When I install the program as a service using srvinst.exe and srvany.exe it is no longer able to write on the mapped drive. When I try to write on the C: drive there is no problem. I tried several option to run the service with the administrator account but none was succesfull.
Does someone have a suggestion? Or an example how to write a windows service (using VC6.0) to avoid using srvany
Ron Bakker
Participate on our website and join the conversation
This topic is archived. New comments cannot be posted and votes cannot be cast.
Responses to this topic
Windows 2000 and above creates a set of drive letters for each user. Services are not able to access these drives, unless a service running as local system maps the drive. Don't ask me, as Microsoft. The way we got around this issue was by using UNC paths (\\machine name\path). Another way is to create a service that maps your drives, must run as local system, or map the drive in your program. If you are using Microsoft Services for unix or MKS, you can mount the drive by typing mount <\\machine\path> <drive letter>.
Good Luck
Good Luck