Mount disk for using as share
First of all need
Enable xp_cmdshell with sp_configure
The following code with enable xp_cmdshell using sp_configure. You need to issue the RECONFIGURE command after each of these settings for it to take effect.
-- this turns on advanced options and is needed to configure xp_cmdshell EXEC sp_configure 'show advanced options', '1' RECONFIGURE -- this enables xp_cmdshell EXEC sp_configure 'xp_cmdshell', '1' RECONFIGURE
Disable xp_cmdshell with sp_configure
The following code with disable xp_cmdshell using sp_configure:
-- this turns on advanced options and is needed to configure xp_cmdshell EXEC sp_configure 'show advanced options', '1' RECONFIGURE -- this disables xp_cmdshell EXEC sp_configure 'xp_cmdshell', '0' RECONFIGURE
EXEC XP_CMDSHELL 'whoami'
EXEC XP_CMDSHELL 'net use'
EXEC XP_CMDSHELL 'net use U: \\uuuuuuuuu.your-storagebox.de\backup /user:uuuuuuuuu *********************'
EXEC XP_CMDSHELL 'dir u:'
EXEC XP_CMDSHELL 'net use'
EXEC XP_CMDSHELL 'net use u: /Delete'