Connect SQL Server to a Windows Shared Folder


/ Published in: SQL
Save to your folder(s)

This is how you can connect SQL Server to a Share folder for your backups. After running this, you will see the letter T: in the GUI. Each line must be run seperatly.


Copy this code and paste it in your HTML
  1. EXEC xp_cmdshell 'NET USE'-- to list the mapped drives
  2. EXEC xp_cmdshell 'NET USE T: \\10.106.74.20\share /user:10.106.74.20\pollusb password' --to connect
  3. EXEC xp_cmdshell 'DIR T:\ /b'
  4. EXEC xp_cmdshell 'NET USE T: /D' -- to remove the share
  5. -- Note : you can also make the connection permanent by using /PERSISTENT:YES
  6. -- More info on NET USE /? on CMD

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.