Re: How to get current drive mapping



"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.

.



Relevant Pages

  • Re: How to get current drive mapping
    ... I've looked at WNetGetUniversalName but it has the same problem as ... drive mapping for that logon session and thus the UNC path. ... process do the resolution of the mapped drive to the UNC path. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to get current drive mapping
    ... the only option that you have here is to have the client ... process do the resolution of the mapped drive to the UNC path. ... Presumably, therefore, I need to get the drive mapping either for the user ... session ID. ...
    (microsoft.public.dotnet.languages.csharp)
  • Hack to create different mapped drives per TS session
    ... able to achieve that solely with the information obtained from a TS session. ... drive letter to it and keep it locked until the user logs off from the TS ... network share and create a bunch of folders in there named "0" to "y" (where ... machine running Terminal Server, and have more than one Terminal Server work ...
    (microsoft.public.windows.terminal_services)
  • Re: User Profile settings in user account: connect drive to path
    ... you should get the correct drive mapping .. ... We were running a Samba PDC along with a Windows Server 2003 member ... connect a drive letter to a specified path. ... Domain Admins group whereas the first mentioned user is not. ...
    (microsoft.public.windows.server.active_directory)
  • Re: Drive mapping
    ... If your service provides the appropriate credentials then it will ... drive letter in the foreground session, ... > Windows 2000 so I am wondering what changed inthe security to stop this. ...
    (microsoft.public.windows.server.general)

Loading