Solved

Mapped drive letters in Windows Services

Posted on 2009-05-11
4
352 Views
Last Modified: 2012-05-06
We've written a Windows Service which reads a path for data files from the Registry.

If the data file path is on a network rather than on the local machine we have found we need to run the Service using the Admin name and password in the Logon tab of the services manager.

However we have encountered another problem if the path is given as a mapped drive letter in the Registry. The Service cannot understand the drive letter (what were Microsoft thinking of??!!!) and therefore our Service is going to have to resolve this to a UNC pathname before using it.

We have no way of testing this before putting it on site so your advice appreciated. If we use the relevant API (or probably Delphi's ExpandUNCFilename) to get the full UNC pathname, will our Service be given the path or is this information hidden from all Services as some sort of security measure?

Many thanks.
0
Comment
Question by:ChrisJonesLycos
  • 2
  • 2
4 Comments
 
LVL 84

Expert Comment

by:oBdA
ID: 24352891
This is not an error from Microsoft. Mapped drives are *user* specific, *NOT* machine specific.
For the obvious reasons, if a service needs access to network resources, this service *has* to run under an account that has permissions to access this network resource. This can be a domain user account, or the local "Network Service" account (in which case the computer object needs permissions for the network resource).
Access to this network resource (and the service configuration) should happen with the UNC, not with a mapped drive.
0
 

Author Comment

by:ChrisJonesLycos
ID: 24352976
Many thanks, oBdA.

When you say "the local "Network Service" account (in which case the computer object needs permissions for the network resource)" I don't really understand. Would you mind explaining this to me.

0
 
LVL 84

Accepted Solution

by:
oBdA earned 500 total points
ID: 24353044
There are some special accounts used to run services, namely LocalService, NetworkService, LocalSystem. Depending on what you want to do with your service, one of those can be used to run a service instead of a domain user. Check here for details:
Service User Accounts
http://msdn.microsoft.com/en-us/library/ms686005(VS.85).aspx
0
 

Author Closing Comment

by:ChrisJonesLycos
ID: 31580072
Many thanks. That's very helpful.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
LAN or WAN ? 11 95
Convert MS Word document to a PDF file 9 90
Delphi...Split view - idea? 1 87
Determine if SQL is installed in Server 2008 R2 4 94
This is a little timesaver I have been using for setting up Microsoft Small Business Server (SBS) in the simplest possible way. It may not be appropriate for every customer. However, when you get a situation where the person who owns the server is i…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

766 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question