Re: How to get current drive mapping
- From: "Willy Denoyette [MVP]" <willy.denoyette@xxxxxxxxxx>
- Date: Mon, 19 Mar 2007 12:10:11 +0100
"Dave" <Dave@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:5D025924-A27A-4942-900F-FEE0EFBAA80E@xxxxxxxxxxxxxxxx
I am actually trying to get the UNC path of the main module of a process
running from a mapped drive, and I am trying to do this from a service. The
ProcessModule class only provides the full path with the mapped drive letter,
but the drive letter refers to the drive mapping for the user that started
the process, and cannot be resolved to a UNC path from a service running
under LocalSystem.
Presumably, therefore, I need to get the drive mapping either for the user
account associated with the process, or possibly even for the process's
session ID (I am not clear whether mappings are per user or per session). Can
anyone give me a clue as to how I go about this?
--
Dave
Drive mappings are per logon session. The easiest way to resolve this is by using System.Management and the WMI classes Win32_MappedLogicalDisk and Win32_LogonSession.
The ProviderName property of the Win32_MappedLogicalDisk instance holds the UNC path name of the associated SessionID and the drive letter.
Willy.
.
- Prev by Date: Re: winforms control question
- Next by Date: Re: make changes to LoginView control?
- Previous by thread: Re: How to get current drive mapping
- Next by thread: Re: How to get current drive mapping
- Index(es):
Relevant Pages
|
Loading