Skip navigation
Map SMB drive using PowerShell

Map SMB drive using PowerShell

Q. How can I map an SMB share using PowerShell?

A. To map an SMB shell using PowerShell utilize the New-SmbMapping cmdlet which also enables a username and password to be specified. For example:

New-SmbMapping -LocalPath X: -RemotePath \\\Software -username 'savilltech\administrator' -Password 'Password'

Once connected applications can be executed from the new path (remember that a period (.) is required with PowerShell), for example:

.'X:\SQL Server\SQLServer2012SP3\Setup.exe' /ConfigurationFile="C:\Assets\ConfigurationFile.ini"

To disconnect you can use:

Remove-SmbMapping -LocalPath X: -Force

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.