473,761 Members | 10,276 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access mapped drive from a Windows Service

Hi to all,

is there a way to access a mapped network drive from
a Windows Service application ?

I created a very simple one, using a timer that checks for a file existance
on G:\Emails
(a Novell server mapped drive)
I created the Service with "LocalSyste m" for the ServiceProcess. Account
and it cannot find the G:\ drive.

I try to declare it to run under the Administrator account but when it tries
to install (installutil) it asks for the credentials and it then fails,
even if the UserName/Password stuff is correct...

Does anyone has a solution to this ?

Thanks a lot for any help
anthonyb
Nov 15 '05 #1
5 28971
Since it's a mapped drive, that drive does not exists for the account you
used. I would suggest instead of using G:\, to use an UNC Path, for example
\\myserver\mysh are\
--
Greetz

Jan Tielens
_______________ _______________ __
Read my weblog: http://weblogs.asp.net/jan
"Anthony Boudouvas" <an******@media trel.com> wrote in message
news:uy******** ******@TK2MSFTN GP10.phx.gbl...
Hi to all,

is there a way to access a mapped network drive from
a Windows Service application ?

I created a very simple one, using a timer that checks for a file existance on G:\Emails
(a Novell server mapped drive)
I created the Service with "LocalSyste m" for the ServiceProcess. Account
and it cannot find the G:\ drive.

I try to declare it to run under the Administrator account but when it tries to install (installutil) it asks for the credentials and it then fails,
even if the UserName/Password stuff is correct...

Does anyone has a solution to this ?

Thanks a lot for any help
anthonyb

Nov 15 '05 #2
Hey Jan,
many thanks for the quick reply!

I also tested that, in fact if i use the command
Console.WriteLi ne(File.Exists( @"\\med\vol1\em ails\a.txt").To String());
in a Console Application, it gives me true,

but if i give that in the Windoew Service, in form of
EventLog.WriteE ntry(File.Exist s(@"\\med\vol1\ emails\a.txt"). ToString()));

it gives me false...

Does another idea come to your mind ?

Thanks again!

anthonyb

"Jan Tielens" <ja*@no.spam.pl ease.leadit.be> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Since it's a mapped drive, that drive does not exists for the account you
used. I would suggest instead of using G:\, to use an UNC Path, for example \\myserver\mysh are\
--
Greetz

Jan Tielens
_______________ _______________ __
Read my weblog: http://weblogs.asp.net/jan


Nov 15 '05 #3
Max
Mapped drive is mapped for some specific user, while service is running in
another context and is not aware of this mapping.
There is a privilege called "Log on as a service". The user account you
specify for service should have this privilege. Use secpol.msc to grant it.
Also consider specifying URN path, like \\someserver\So meShare\Email instead
of G:\Emails.
You might also experience problems accessing shares with
yourcomputer\Lo calSystem principal...

"Anthony Boudouvas" <an******@media trel.com> wrote in message
news:uy******** ******@TK2MSFTN GP10.phx.gbl...
Hi to all,

is there a way to access a mapped network drive from
a Windows Service application ?

I created a very simple one, using a timer that checks for a file existance on G:\Emails
(a Novell server mapped drive)
I created the Service with "LocalSyste m" for the ServiceProcess. Account
and it cannot find the G:\ drive.

I try to declare it to run under the Administrator account but when it tries to install (installutil) it asks for the credentials and it then fails,
even if the UserName/Password stuff is correct...

Does anyone has a solution to this ?

Thanks a lot for any help
anthonyb

Nov 15 '05 #4
Hey Max,

thanks for the reply.

Ok, i see the problem.
I state in ServiceProjectI nstaller that i want to run under the "User"
property value.
I also use the secpol.msc to tell thet a user account (the same that i log
in to my system)
will have the "Log on as a service" priviledge.
Bu when i run the installutil and give it the credentials for that account,
i got back a "The account name is invalid or the password for this account
is invalid .."
message, even if they DO exist and they are correctly given to it...

A, as i told toy Jan (that already posted a reply to me),
the command
EventLog.WriteE ntry(File.Exist s(@"\\med\vol1\ emails\a.txt"). ToString()));

that i run from the Windows Service, gives me false...
Another thing to check ?

Thanks a lot !

anthonyb

"Max" <Pl****@reply.t o.news.group> wrote in message
news:eN******** ******@TK2MSFTN GP10.phx.gbl...
Mapped drive is mapped for some specific user, while service is running in
another context and is not aware of this mapping.
There is a privilege called "Log on as a service". The user account you
specify for service should have this privilege. Use secpol.msc to grant it. Also consider specifying URN path, like \\someserver\So meShare\Email instead of G:\Emails.
You might also experience problems accessing shares with
yourcomputer\Lo calSystem principal...

Nov 15 '05 #5
Your user account that you are using for the service probibly does not
have permissions on the server...

S. Steefel, MCSE
Snr. Software Engineer
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #6

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

Similar topics

6
9740
by: moonriver | last post by:
I write a program accessing files in network drive o:. It is doable as a standalone application. However, if it is running under windows service, the following exception will appear: 13/07/2004 10:24:48 AM run() error: System.IO.IOException: The specified network password is not correct. at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare...
3
7645
by: Daniel Xiao | last post by:
I write a program accessing files in network drive o:. It is doable as a standalone application. However, if it is running under windows service, the following exception will appear: 13/07/2004 10:24:48 AM run() error: System.IO.IOException: The specified network password is not correct. at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare...
2
9531
by: Dave Stewart | last post by:
I am attempting to write a vb.net windows service that will automate various file movements on my network. When I attempt to access files on a mapped drive or UNC file share, I get exceptions claiming that the file is not there. However if I copy the file path directly in to explorer it pops right up. I know that my service is running as local system and this must be causing the problems. When I write the windowsidentity.getcurrent().name...
8
9761
by: Sarah | last post by:
I need to access some data on a server. I can access it directly using UNC (i.e. \\ComputerName\ShareName\Path\FileName) or using a mapped network drive resource (S:\Path\FileName). Here is my problem: my vb.net program has problems with UNC. If the UNC server is restarted or goes off-line, my VB.net program crashes. The code for UNC access to the file is included below and is put in the tick event of a form timer control running every...
5
1578
by: Marc | last post by:
I am trying to run a web service that has pre-compiled dll's that reference dll's that are on a mapped drive. The web service can not load because it does not see that mapped drive and returns an error of "Can not file specified module". Mapped drive is added to path. Thanks, Marc
4
11739
by: sajid_yusuf | last post by:
Hi I am trying to develop a Windows service in VB.NET which has timer enabled and keeps checking a folder (or group of folders) for any new file or changed files. As soon as it detects any new file or changes (to files or folders) then it copies the files (and any new folders) to a folder in the mapped network drive. So far I have been successful in developing and deploying the service which works on my local machine with two drives...
1
2037
by: Jack | last post by:
Hi, My OS is Windows XP. I mapped a drive on another machine running Windows 2000. I set the permission of the mapped drive on the Windows 2000 machine to be "accessible to everyone". On the Windows XP machine I can access the mapped drive through Explore. By one of my third party software can not access the mapped drive if I only use the drive ID of the mapped drive, like E:. If I use UNC, e.g., \\host\\directory, the third party...
5
5367
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I am trying to accesss a Mapped Drive from my asp.net code running on IIS 6.0. I am using a FileUpload control and fileUpload.SaveAs() to save the file to the server. I want to save the file to a mapped drive that is mapped to a share on the network. When I save to "C:\temp\myFile.txt it works but when I save to Z:\temp\myFile.txt is will not work. I also want to copy, delete and move these files. I have found some pages on the net...
25
3013
by: p byers | last post by:
Good Morning Folks I have a LAN Among the several connections to it are the following four devices: A MAXSTOR network Storage Device A PC running Microsoft Windows 2000 Server 5.0.2195 (SP4) A PC running Microsoft Windows XP Professional 5.1.2600 (SP2) A PC running Microsoft Windows XP Professional 5.1.2600 (SP2) All of the PCs are running IIS
0
9531
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9345
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10115
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8780
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7332
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5229
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3881
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.