Access to mapped network drive from a service

2

I created a service via srvany.exe like decribed here. This application needs access to a mapped network drive. I manually mapped this drive as local Administrator, but my application/service does not have access to it.

I tried to start the service with the local Administrator credentials. But neither, the default System-Account nor the local Administrator seem to have access to the network.

If I manually start the application using the local Administrator account, the application has access to the network.

What do I have to configure, that my service can access a mapped network folder?

Edit:
I wrote a small batch file similar to the following and edited the registry that the service starts the batch instead of the exe. So I tried to map and run the exe with the same credentials. But it still failes:

net use V: /DELETE
net use V: \\Server\Folder\Folder /user:UserName password /PERSISTENT:YES
"C:\Program Files\MyApplication\MyApplication.exe"

Matthias

Posted 2011-12-15T09:50:05.480

Reputation: 41

Mapping a drive non-interactively may need the account to have a right that it doesn't normally have (look at ntrights.exe from the same resource kit you got srvany.exe from). If the application can work with UNC paths I'd try what @Matthias suggests. – LawrenceC – 2013-03-25T01:56:08.123

Answers

2

I found a similar question on serverfault.
I gave up to map the share and configured my application to directly access the path (\\Server\Folder...). Then I started the service using a domain account that has access to that shared folder.
As far as I read at various web sides, there seems to be a difference between the logged on user and a service. A mapped network folder by the logged on user is not mapped for "another" user like a service, even if the service runs with the same credentials as the logged on user.

Matthias

Posted 2011-12-15T09:50:05.480

Reputation: 41