How do I enable user-level mapped drives for Windows services?

I have two Windows services, “ServiceA” and “ServiceB”. Each service runs under the user names “UserA” and “UserB” respectively, and in all other respects the services are identical (separate instances of the same service).

What I would like to be able to do is set up mapped drives so that UserA’s Z: drive points to a network share (\FileServer\ServiceAFiles), and UserB’s Z: drive points to a different share (\FileServer\ServiceBFiles). I can’t configure the services separately; wherever I point one service to look for files, that is where the other will look as well, so setting up a Z: and a Y: drive is impossible.

I tried setting up mapped drives that “reconnect at login,” but the services can’t see the drives, so it seems like the services don’t do a “traditional” login. Google tells me the only way to do this is by changing the source code of the service so that it creates a mapped drive when it starts up. Unfortunately, the service is from a third-party and I don’t have access to the source code.

Really, I just want two services to be pointed to two different network shares using the same path, so the question I have is, is there a workaround to allow me to do what I want to do?

Answer

I’ve done this in the past on Windows Server 2003 with domain accounts that are granted logon interactively and as service rights and a simple drive mapping script deployed to those accounts with the login script group policy. It did work, but it was quite some time ago (and was for a legacy service application that couldn’t handle UNC paths of course).

What windowsversion is this? What accounts are you using, local or domain? How are you mapping the drives? Try using a startup/login script policy. Perhaps the services need the old “interact with desktop” flag for this, I can’t recall right now.

Attribution
Source : Link , Question Author : Community , Answer Author : Oskar Duveborn

Leave a Comment