Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 467
  • Last Modified:

Windows Service Vs Normal Exe

Hi,

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?
0
justin_smith
Asked:
justin_smith
1 Solution
 
TimCotteeCommented:
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.

Regards,

TimCottee
0
 
justin_smithAuthor Commented:
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?
0
 
balmasriCommented:
grant the domain  user account that you run the service the security right : login as a service"
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
justin_smithAuthor Commented:
how and where do i need to do this?
0
 
MattiCommented:
Hi!

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.

Regards!
Matti
0
 
purplepomegraniteCommented:
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.
0
 
justin_smithAuthor Commented:
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
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/2003_Server/Q_24157796.html

http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_24139701.html

May be info that is shared there is helpful for you
0
 
purplepomegraniteCommented:
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?
0
 
justin_smithAuthor Commented:
hi guys,

we got this working by using unc paths instead of mapped drives..
.
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q180362

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

Thanks
0
 
purplepomegraniteCommented:
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.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now