EXEC sp_configure
'show advanced option',
'1';
RECONFIGURE WITH OVERRIDE;
EXEC sp_configure 'xp_cmdshell', 1;
GO
RECONFIGURE;
--EXEC xp_cmdshell 'dir \\server.company.com\sharedfolder\';
--EXEC sp_xp_cmdshell_proxy_account 'dmain\userid','password'
--Exec master.dbo.xp_cmdshell 'net use t: /delete'
--EXEC xp_cmdshell 'net use t: \\DSHSUTLCY3RST01.DSHS.WA.LCL\BACKUPS\DSHSDBOLY3LGC01 password /user:domain\userid /persistent:no'
--set @fileName ='t:\CAAIRS\CAAIRS-PROD_Full_Database_' + @ts + '.bak'
--BACKUP DATABASE [CAAIRS] TO DISK = @fileName WITH NOFORMAT, INIT, NAME = N'CAAIRS-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, COMPRESSION, STATS = 10
--Exec master.dbo.xp_cmdshell 'net use t: /delete'
--EXEC xp_cmdshell 'del "d:\Extended Event File Logs\childlocation*"';
EXEC xp_cmdshell 'dir "d:\Extended Event File Logs\*.*"';
--EXEC xp_cmdshell 'mkdir "d:\Extended Event File Logs"';
GO
EXEC sp_configure 'xp_cmdshell', 0;
GO
RECONFIGURE;
EXEC sp_configure
'show advanced option',
'0';
RECONFIGURE WITH OVERRIDE;