Get-SmbMapping

Get the drives mapped to an SMB share. Requires PowerShell 5.0+ and Windows 10.

Syntax
      Get-SmbMapping [[-LocalPath] String[]] [[-RemotePath] String[]]
         [-CimSession CimSession[]] [-ThrottleLimit Int32] [CommonParameters]

Key
   -CimSession [CimSession[]]
       Run the cmdlet in a remote session or on a remote computer.
       Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet.
       The default is the current session on the local computer.

   -LocalPath [String]
       The local path used to map the remote path on this computer.

   -RemotePath [String]
       The remote path that is accessed from this computer.

   -ThrottleLimit [Int32]
       The maximum number of concurrent operations that can be established to run the cmdlet.
       If this parameter is omitted or a value of 0 is entered, then PowerShell will calculate an optimum throttle limit 
       for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies 
       only to the current cmdlet, not to the session or to the computer.

Examples

Get all SMB mappings:

PS C:\> Get-SmbMapping

Get the SMB mapping for X:

    PS C:\> Get-SmbMapping X:

    Status            Local Path         Remote Path
    ------            ----------         -----------
    OK                X:                 \\Server64\Germany

Retrieve the SMB client directory mapping for the Z: directory:

PS C:\> Get-SmbMapping -LocalPath Z: | Select-Object LocalPath, Status, RemotePath

“Technology is not neutral. We're inside of what we make, and it’s inside of us. We're living in a world of connections — and it matters which ones get made and unmade” ~ Donna Haraway

Related PowerShell Cmdlets

New-SmbMapping - Create a mapping to an SMB share.
New-PSDrive - Create a mapped network drive (Windows 7).
Get-CimInstance -class Win32_Share - List the available remote shares.
Get-SmbConnection - Retrieve the connections established from the SMB client to the SMB servers.
Windows cmd command: NET USE - Map drive.


 
Copyright © 1999-2024 SS64.com
Some rights reserved