Friday, September 11, 2020

Enable network drives in SQL Management Studio

 https://vandijk.cloud/restore-sql-backup-from-a-network-share/


use Master;
EXEC sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
EXEC sp_configure 'xp_cmdshell',1
GO
RECONFIGURE
GO
EXEC XP_CMDSHELL 'net use H: \\RemoteServerName\ShareName'

If the specific share has authentication enabled you might have the change the last command to:

EXEC XP_CMDSHELL 'net use H: \\RemoteServerName\ShareName' /user:domain\username ThePassword

No comments:

Post a Comment