473,406 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Accessing network drive from Windows Service

(Type your message here)
I Think it's the stupidness of Windows. Why the service can't access network drive but console apps or windows application can do it?
So my suggestion is make the program for accessing network drive in console apps, then call it with your windows service.. via windows API ..he..he that should work.

Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

--------------------------------
From: mbah Sumani warung_cethe@bolorejo

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>iQk0l249UEqW1MPZCewMJQ==</Id>
Nov 17 '05 #1
1 9423
The service can't access the network drive because by default, it runs
under the LocalService account, which does not have permissions to access
the network. Services do not get any special privledges by default. The
reason you can access the drive through a console or windows app is because
you have rights to it, and by extension, the program running has rights to
it as well.

If you create a console app and then call it from the service, it will
NOT work.

You need to change the account that the service runs under to the
NetworkService account. That has access to the network.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"mbah Sumani via .NET 247" <an*******@dotnet247.com> wrote in message
news:uT**************@TK2MSFTNGP10.phx.gbl...
(Type your message here)
I Think it's the stupidness of Windows. Why the service can't access
network drive but console apps or windows application can do it?
So my suggestion is make the program for accessing network drive in
console apps, then call it with your windows service.. via windows API
..he..he that should work.

Public Declare Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal
lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As
String, ByVal nShowCmd As Long) As Long

--------------------------------
From: mbah Sumani warung_cethe@bolorejo

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>iQk0l249UEqW1MPZCewMJQ==</Id>

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Robert Tarantino | last post by:
Hello, I am trying to find a way to create a scheduled task or service that will copy my local profile folders under "Documents and settings" to a network drive. This would allow me to restore...
5
by: Niloday | last post by:
Hi All, I am trying to access a mapped network drive from a service that I have created. The service needs to create/delete folders/files on a network drive. When I tried to connect to a...
1
by: Max Baki via .NET 247 | last post by:
I all, i've write a sample ftp Windows service which download files and copy them on remote share or remote mapped drive (the service works fine on local drives). This part of code is the...
3
by: Bonj | last post by:
I need to write a windows service, and the only way it can access a shared drive on a file server on the network is if the installer is put in "User" mode - "LocalService", "LocalSystem" and...
3
by: Bonj | last post by:
I have a service which is a Windows Service, but it is running under a User account - I enter my own credentials on installing. It can access network files by specifying the full UNC path, i.e....
6
by: Bijesh | last post by:
Hi All, I've developed a Windows Service that acts as a remoting server (.NET Remoting). The client(user) is able to connect to the server and start a program by giving the executable path of...
3
by: Brecht Yperman | last post by:
Hi, I am running a .NET application as a Windows Service. In that application I create a FileSystemWatcher. I want it to watch a network drive which maps to an IBM iSeries IFS directory....
3
by: Miriam | last post by:
Hello, I created a Windows Service in VB.NET, which is to purge files periodically in the local system and also in the shared network drive. Here is my problem: 1. If I set the “Account”...
17
by: ayush patel | last post by:
Hi all, I have created a windows service that has a file watcher and does some operation after it reads that file. i developed it in my local machine and installed the service on server. i have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.