Map SMB drive using PowerShell

Use PowerShell to simply map SMB shares.

John Savill

August 19, 2016

1 Min Read
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 \10.10.10.1Software -username 'savilltechadministrator' -Password 'Password'

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

.'X:SQL ServerSQLServer2012SP3Setup.exe' /ConfigurationFile="C:AssetsConfigurationFile.ini"

To disconnect you can use:

Remove-SmbMapping -LocalPath X: -Force

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like