Author: Cole Francis, Architect
THE PROBLEM
I was recently tasked with restoring a 220GB SQL Server backup file using SQL Server 2014 Management Studio (SSMS), and the database server I was restoring the backup to was very limited on space. So, we threw the SQL backup file on a UNC share with an abundance of space, and I conveniently mapped a drive to the UNC share on the database server.
THE SOLUTION
Unfortunately, when it came time to restore the SQL backup file in SSMS, I was unable to see the newly mapped drive in SSMS, even though I could plainly see it in a File Explorer window. So, to get around this little problem, I ran the following SQL commands, and now the mapped drive shows up properly in SSMS:
-- Turn on the advanced options
exec sp_configure 'show advanced options', 1
go
reconfigure
go
-- Reconfigure the advanced options values and enable the command shell
exec sp_configure 'xp_cmdshell', 1
go
reconfigure
go
-- Force SSMS to display the mapped drive
exec xp_cmdshell 'net use Z: \\YourNetworkFolder\YourSubFolder\YourSubSubFolder YourPassword /user:YourDomainName\YourUserName'
Thanks for reading and keep on coding! 🙂