6 thoughts on “List mapped drives from command line”

  1. ‘net use ‘ perfectly lists nw shares linked to drive letters, including subdirectories only in the standard smb case. However for drive letters linked to rdp shares subdirectories are not reproduced.
    Assume we have passed G: along with mstsc using rdp.
    Assume further there exists a subdir G:\mysubdir .
    The remote computer sees an rdp share \\TSCLIENT\G
    A subsequent
    net use G: \\TSCLIENT\F\mysubdir
    links to the subdir directly. But a ‘net use’ will show just
    G: \\TSCLIENT
    then. Seems to be a MS error.
    Regards

    Reply
    • This will list all mapped drives for the user running the PowerShell console.

      Get-WmiObject Win32_NetworkConnection | Select-Object RemoteName, LocalName | Sort-Object LocalName | Format-Table -AutoSize

    • For powershell I highly recommend this command to show mapped drives:
      Get-SMBMapping

      And here are 2 other commands you can use for similar effect.
      Get-PSDrive -PSProvider FileSystem | Select-Object name, @{n=”Root”; e={if ($_.DisplayRoot -eq $null) {$_.Root} else {$_.DisplayRoot}}}

      Get-WmiObject -Class Win32_MappedLogicalDisk | select Name, ProviderName

Leave a Comment