I have written a Windows Service which enumerates the files in a directory.
I am trying the enumerate the files of a mapped drive.It works fine on a
windows 2000 Box.But the same ,does'nt work on a xp or a 2003 machine.
Any Ideas why it would do that???

Thanks
MVB

Re: Windows service Unable to access mapped drives on XP and 2003 Boxe by Luc

Luc
Fri Jun 03 23:41:09 CDT 2005

Bear in mind that LocalSystem do not have network access. Make your service
run for a specific account. Then make sure that this account is trusted on
the machines where your shares are located and the latter have proper ACLs.
For workstations local accounts (peer-to-peer not using a domain account)
basically that means having the same username AND PASSWORD on each machine ;
in domain it is a bit easier.

/LM

"MVB" <MVB@discussions.microsoft.com> wrote in message
news:3AC2DB37-158C-4C76-825E-66C389E11E9A@microsoft.com...
>I have written a Windows Service which enumerates the files in a directory.
> I am trying the enumerate the files of a mapped drive.It works fine on a
> windows 2000 Box.But the same ,does'nt work on a xp or a 2003 machine.
> Any Ideas why it would do that???
>
> Thanks
> MVB
>
>



Re: Windows service Unable to access mapped drives on XP and 2003 Boxe by Willy

Willy
Sat Jun 04 15:49:37 CDT 2005


"Luc E. Mistiaen" <luc.mistiaen@advalvas.be.no.spam> wrote in message
news:OKGLi%23LaFHA.1940@TK2MSFTNGP10.phx.gbl...
> Bear in mind that LocalSystem do not have network access. Make your
> service run for a specific account. Then make sure that this account is
> trusted on the machines where your shares are located and the latter have
> proper ACLs. For workstations local accounts (peer-to-peer not using a
> domain account) basically that means having the same username AND PASSWORD
> on each machine ; in domain it is a bit easier.
>
> /LM
>

Luc,

Bear in mind that not all services run as LocalSystem (it's even suggested
no to do so), services that run as "Network Service" or "Local Service" do
have network access. When used in a Kerberos realm these services can access
remote resources as they use the machine account (DOMAIN\MACHINE$) to
authenticate on the network so it's a simple matter to add this account to
the ACL's for the resource (any) on the resource server.

Willy.



Re: Windows service Unable to access mapped drives on XP and 2003 Boxe by Luc

Luc
Sat Jun 04 22:48:42 CDT 2005

Yes I know that, I just wanted to draw the attention of MVB on points that
could make its service fail to access network shares. There wasn't enough
information to tell what's what really going on and I presented one common
problem: you install your first service without too much thinking and it
ends up by default as LocalSystem.

/LM
"Willy Denoyette [MVP]" <willy.denoyette@telenet.be> wrote in message
news:%23WNFubUaFHA.464@TK2MSFTNGP15.phx.gbl...
> Luc,
>
> Bear in mind that not all services run as LocalSystem (it's even suggested
> no to do so), services that run as "Network Service" or "Local Service" do
> have network access. When used in a Kerberos realm these services can
> access remote resources as they use the machine account (DOMAIN\MACHINE$)
> to authenticate on the network so it's a simple matter to add this account
> to the ACL's for the resource (any) on the resource server.
>
> Willy.
>
>



Re: Windows service Unable to access mapped drives on XP and 2003 by MVB

MVB
Mon Jun 06 08:55:01 CDT 2005

But My service is not running on the LocalSystem.It runs under a user account
with the Domain\Administrator credentials.And the mapped drives can be
accessed on a windows 2000 box using the same service.But has problems with
XP and 2003.
Is this information sufficient?

Thanks


"Luc E. Mistiaen" wrote:

> Yes I know that, I just wanted to draw the attention of MVB on points that
> could make its service fail to access network shares. There wasn't enough
> information to tell what's what really going on and I presented one common
> problem: you install your first service without too much thinking and it
> ends up by default as LocalSystem.
>
> /LM
> "Willy Denoyette [MVP]" <willy.denoyette@telenet.be> wrote in message
> news:%23WNFubUaFHA.464@TK2MSFTNGP15.phx.gbl...
> > Luc,
> >
> > Bear in mind that not all services run as LocalSystem (it's even suggested
> > no to do so), services that run as "Network Service" or "Local Service" do
> > have network access. When used in a Kerberos realm these services can
> > access remote resources as they use the machine account (DOMAIN\MACHINE$)
> > to authenticate on the network so it's a simple matter to add this account
> > to the ACL's for the resource (any) on the resource server.
> >
> > Willy.
> >
> >
>
>
>

Re: Windows service Unable to access mapped drives on XP and 2003 by Willy

Willy
Mon Jun 06 10:39:49 CDT 2005


"MVB" <MVB@discussions.microsoft.com> wrote in message
news:0ED2551D-AE3E-49B2-BBD1-6BAA8839B339@microsoft.com...
> But My service is not running on the LocalSystem.It runs under a user
> account
> with the Domain\Administrator credentials.And the mapped drives can be
> accessed on a windows 2000 box using the same service.But has problems
> with
> XP and 2003.
> Is this information sufficient?
>
> Thanks
>


How exactly did you "mapped the drive", was the mapping done from within
the service code, or by any other means?

Willy.

Note: You should never use mapped drives, use UNC paths instead.



Re: Windows service Unable to access mapped drives on XP and 2003 by MVB

MVB
Mon Jun 06 11:56:04 CDT 2005

The mapping is not done from within the service.I have mapped the drives
using windows Explorer "Map Network Drives".

Thanks


"Willy Denoyette [MVP]" wrote:

>
> "MVB" <MVB@discussions.microsoft.com> wrote in message
> news:0ED2551D-AE3E-49B2-BBD1-6BAA8839B339@microsoft.com...
> > But My service is not running on the LocalSystem.It runs under a user
> > account
> > with the Domain\Administrator credentials.And the mapped drives can be
> > accessed on a windows 2000 box using the same service.But has problems
> > with
> > XP and 2003.
> > Is this information sufficient?
> >
> > Thanks
> >
>
>
> How exactly did you "mapped the drive", was the mapping done from within
> the service code, or by any other means?
>
> Willy.
>
> Note: You should never use mapped drives, use UNC paths instead.
>
>
>

Re: Windows service Unable to access mapped drives on XP and 2003 by MVB

MVB
Mon Jun 06 12:00:01 CDT 2005

I am developing a backup application.And our client wants to backup a Mapped
drive.Thats the reason i am usinf Mapped drives.

"Willy Denoyette [MVP]" wrote:

>
> "MVB" <MVB@discussions.microsoft.com> wrote in message
> news:0ED2551D-AE3E-49B2-BBD1-6BAA8839B339@microsoft.com...
> > But My service is not running on the LocalSystem.It runs under a user
> > account
> > with the Domain\Administrator credentials.And the mapped drives can be
> > accessed on a windows 2000 box using the same service.But has problems
> > with
> > XP and 2003.
> > Is this information sufficient?
> >
> > Thanks
> >
>
>
> How exactly did you "mapped the drive", was the mapping done from within
> the service code, or by any other means?
>
> Willy.
>
> Note: You should never use mapped drives, use UNC paths instead.
>
>
>

Re: Windows service Unable to access mapped drives on XP and 2003 by Willy

Willy
Mon Jun 06 12:18:29 CDT 2005

Well that explain it all.
Share mappings are login session bound, that means that if you map a shared
drive in a Logon session of an interactive user, this mapped drive will not
be usable from within another Logon session (your service login session)
EVEN if the service account is the SAME as the interactive Logon. One
possible solution is to map the drive from within the service (using
PInvoke). Another option is to run the service using a local account that
has a shadow on the remote server (that is an account with the same name and
password on both servers). And the third is to use UNC paths, you remark
about "the client wants... "is not really valid, what the client wants is a
backup right?


Willy.


"MVB" <MVB@discussions.microsoft.com> wrote in message
news:EE5FF0C1-4281-4F1C-8701-7FF68528D948@microsoft.com...
> The mapping is not done from within the service.I have mapped the drives
> using windows Explorer "Map Network Drives".
>
> Thanks
>
>
> "Willy Denoyette [MVP]" wrote:
>
>>
>> "MVB" <MVB@discussions.microsoft.com> wrote in message
>> news:0ED2551D-AE3E-49B2-BBD1-6BAA8839B339@microsoft.com...
>> > But My service is not running on the LocalSystem.It runs under a user
>> > account
>> > with the Domain\Administrator credentials.And the mapped drives can be
>> > accessed on a windows 2000 box using the same service.But has problems
>> > with
>> > XP and 2003.
>> > Is this information sufficient?
>> >
>> > Thanks
>> >
>>
>>
>> How exactly did you "mapped the drive", was the mapping done from within
>> the service code, or by any other means?
>>
>> Willy.
>>
>> Note: You should never use mapped drives, use UNC paths instead.
>>
>>
>>



Re: Windows service Unable to access mapped drives on XP and 2003 by MVB

MVB
Mon Jun 06 16:19:15 CDT 2005

I agree to what ur saying.

But I was just wondering why does it work on windows 2000 and not on windows
2003.

"Willy Denoyette [MVP]" wrote:

> Well that explain it all.
> Share mappings are login session bound, that means that if you map a shared
> drive in a Logon session of an interactive user, this mapped drive will not
> be usable from within another Logon session (your service login session)
> EVEN if the service account is the SAME as the interactive Logon. One
> possible solution is to map the drive from within the service (using
> PInvoke). Another option is to run the service using a local account that
> has a shadow on the remote server (that is an account with the same name and
> password on both servers). And the third is to use UNC paths, you remark
> about "the client wants... "is not really valid, what the client wants is a
> backup right?
>
>
> Willy.
>
>
> "MVB" <MVB@discussions.microsoft.com> wrote in message
> news:EE5FF0C1-4281-4F1C-8701-7FF68528D948@microsoft.com...
> > The mapping is not done from within the service.I have mapped the drives
> > using windows Explorer "Map Network Drives".
> >
> > Thanks
> >
> >
> > "Willy Denoyette [MVP]" wrote:
> >
> >>
> >> "MVB" <MVB@discussions.microsoft.com> wrote in message
> >> news:0ED2551D-AE3E-49B2-BBD1-6BAA8839B339@microsoft.com...
> >> > But My service is not running on the LocalSystem.It runs under a user
> >> > account
> >> > with the Domain\Administrator credentials.And the mapped drives can be
> >> > accessed on a windows 2000 box using the same service.But has problems
> >> > with
> >> > XP and 2003.
> >> > Is this information sufficient?
> >> >
> >> > Thanks
> >> >
> >>
> >>
> >> How exactly did you "mapped the drive", was the mapping done from within
> >> the service code, or by any other means?
> >>
> >> Willy.
> >>
> >> Note: You should never use mapped drives, use UNC paths instead.
> >>
> >>
> >>
>
>
>

Re: Windows service Unable to access mapped drives on XP and 2003 by Willy

Willy
Mon Jun 06 17:01:48 CDT 2005


"MVB" <MVB@discussions.microsoft.com> wrote in message
news:F88FF541-7AFA-42DA-8341-388479FBC38D@microsoft.com...
>I agree to what ur saying.
>
> But I was just wondering why does it work on windows 2000 and not on
> windows
> 2003.
>

Should not work on W2K as well. Are you sure you are using the same domain
account or at leats a domain account.
Turn on logon auditing (success and failure) on the W2K server and check the
eventlog (security log) to see which user account gets used to authenticate.

Willy.