Why DriveInfo.GetDrives () is not getting a network mapped drive in a Windows service

I have a Windows service developed in .NET C # using VS 2010, I call DriveInfo.GetDrives(), but not get the drive Z:(mapped network drive),

I did some searches and found some results indicating privileges for the Windows account, so I tried all types of installation service accounts like LocalSystem, User, LocalService, NetworkService, but no one worked and I still can’t get the drive Z:.

I did another test debugging a Windows service (like a console application) and I can get the drive Z:this way.

Is there a solution to my problem?

+5
source share
2 answers

You need to start the Windows service with the account that displays the network drive, for example, the same account that you used to run as a console application. Since Hans advised you not to use mapped drives in Windows services, because they are a concept related to the real user.

However, if you really want to continue to use mapped drives, see this related question for traps and workarounds related to this particular situation:

How to map the network drive that the service will use

+6
source

LUID, (, , , ..).

, , . Windows Explorer .

+2

All Articles