Mapping a Network Drive in SQL Management Studio for Backups

Just follow these steps from our Tech Support Team

Open SQL Management Studio and “New Query”

You only need to do this bit once:

EXEC sp_configure ‘show advanced options’, 1;
GO
RECONFIGURE;
GO

EXEC sp_configure ‘xp_cmdshell’,1
GO
RECONFIGURE
GO

Now define that share drive for SQL with the xp_cmdshell command as follows:

Changing H to whatever drive you require

EXEC XP_CMDSHELL ‘net use H: \\RemoteServerName\ShareName /USER:domain\username Passw0rd1’

It should now be mapped. In order to verify the new drive, you can use the below command that will show you all files in that newly mapped drive:

EXEC XP_CMDSHELL ‘Dir H:’

 

Last updated on 8 Oct 2020