By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,854 Members | 1,912 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,854 IT Pros & Developers. It's quick & easy.

Access mapped drive from a Windows Service

P: n/a
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 "LocalSystem" 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
Share this Question
Share on Google+
5 Replies


P: n/a
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\myshare\
--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan
"Anthony Boudouvas" <an******@mediatrel.com> wrote in message
news:uy**************@TK2MSFTNGP10.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 "LocalSystem" 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

P: n/a
Hey Jan,
many thanks for the quick reply!

I also tested that, in fact if i use the command
Console.WriteLine(File.Exists(@"\\med\vol1\emails\ a.txt").ToString());
in a Console Application, it gives me true,

but if i give that in the Windoew Service, in form of
EventLog.WriteEntry(File.Exists(@"\\med\vol1\email s\a.txt").ToString()));

it gives me false...

Does another idea come to your mind ?

Thanks again!

anthonyb

"Jan Tielens" <ja*@no.spam.please.leadit.be> wrote in message
news:%2****************@TK2MSFTNGP12.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\myshare\
--
Greetz

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


Nov 15 '05 #3

P: n/a
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\SomeShare\Email instead
of G:\Emails.
You might also experience problems accessing shares with
yourcomputer\LocalSystem principal...

"Anthony Boudouvas" <an******@mediatrel.com> wrote in message
news:uy**************@TK2MSFTNGP10.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 "LocalSystem" 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

P: n/a
Hey Max,

thanks for the reply.

Ok, i see the problem.
I state in ServiceProjectInstaller 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.WriteEntry(File.Exists(@"\\med\vol1\email s\a.txt").ToString()));

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

Thanks a lot !

anthonyb

"Max" <Pl****@reply.to.news.group> wrote in message
news:eN**************@TK2MSFTNGP10.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\SomeShare\Email instead of G:\Emails.
You might also experience problems accessing shares with
yourcomputer\LocalSystem principal...

Nov 15 '05 #5

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.