PowerTip: Use PowerShell to Map a Drive


Summary: Learn how to use Windows PowerShell to map a drive.

Hey, Scripting Guy! Question How can I use Windows PowerShell  to map a drive to a server from a client running Windows 8.1?

Hey, Scripting Guy! Answer Use the New-SmbMapping cmdlet and specify the local path and the remote path, for example:

New-SmbMapping -LocalPath h: -RemotePath \\dc1\Share

Comments (3)

  1. Anonymous says:

    what’s the difference with New-PSDrve, i.e New-PSDrive -Persist -Name H -PSProvider FileSystem -Root \dc1Share -Description ‘DC1 Share’ ?

  2. __hAl__ says:

    I would also like to know the difference between new-smbmapping and new-psdrive much like HarmVeenstra

  3. nick says:

    new-smbmapping is 2012/8.0 and higher only, so it won’t run on win7 machines. new-psdrive is PSv2 and higher. also new-psdrive has a psprovider parameter that can specify providers outside of filesystem. e.g. new-psdrive can hit the registry, but new-smbmapping
    cannot.
    check the TechNet articles or get-help -full on the cmdlets.
    https://technet.microsoft.com/en-us/library/hh849829.aspx
    https://technet.microsoft.com/en-us/library/jj635700.aspx

Skip to main content