We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


Windows Service Vs Normal Exe

Medium Priority
Last Modified: 2013-11-25

I am struggling to get a service application written in VB6 work..

this is a simple app that deletes some files over  a mapped network drive..

This app is written to run under services.. The app cant cant find the files to delete if it runs under service.. We doubted that it is do with the account under which the service runs.. i even made the service to log on under a domain account (admin) that has access to the mapped network drive..

But interestingly when i run the app just by double clicking the exe it does the deletion without any issues..

I looked the code (bas files)... It doesnt use any specific username in it...

The code simple uses FileSystemObject's FileExists method to look if the file exists before trying to delete.. it cant even find the file...

i dont really understand what is going on...

Any ideas?
Watch Question

Head of Software Services
Hello justin_smith,

Do you actually create the drive mapping within the service when running under the domain account? Have you tried using it with straight UNC pathing to the relevant files.



Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


nope.. drive mapping is already there in my computer already...
i am unable to change any code in the program in concern..
it isnt using UNC though..

What i tried is a simple vbs to delete a few test files in the same mapping .. but i ran it with with csript and not under  a service..

i believe that it is the service factor that is stuffing it up...

i tried a search on google and found this http://www.tomshardware.com/forum/23913-42-problem-copying-files-network-vista
something to do with NTLM or stuff..

I dont have any understand about this stuff though..

any light?
Bassam AlmasriIT Infrastructure Specialist

grant the domain  user account that you run the service the security right : login as a service"


how and where do i need to do this?


Actual if You wan't to run someting VB 6.0 made as service/prosess (not register to services that's completly different) but only make the form visible=False then it run's there and appears to taskmanager as prosess. Not running app's.

When you say it deletes files, is the idea that it constantly monitors and deletes files?  Or just does it once, say per logon?

How are the drives mapped?  It may well be that the mapped drives aren't mapped when the program starts as a service.  Also, how are you running it as a service?  Was it written as a service (not easy in VB6) or are you using srvany?

Without access to the source of the program, it may be difficult to track down the problem.


It does appear in the task manager.. The configuration is also found in Registry for the instance i see in services.msc

It doesnt work even if I restart the service after making sure the mapped drive is there...

The question though is why this application is work when i invoke in cmd and not in the service.

I am trying find answers to the same question from different perspectives
in the following threads too


May be info that is shared there is helpful for you
When you start a service, it starts in the context of the user account specified.  The mapped drives may not be present in that user profile.  Is this a service installed using srvany?


hi guys,

we got this working by using unc paths instead of mapped drives..

This is only a workaround at the moment...

Is there a way to solve this..

it is so strange that MS has restricted Mapped drives for Services

I would suggest that it isn't a workaround, but a solution.  It makes sense that mapped drives aren't available to a service due to the context services run in.  Simply use the UNC paths instead.  The knowledgebase article specifically states that a service should not try to access mapped drives or use api calls to create one.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.