Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

xp_cmdshell is now locked out ... Expand / Collapse
Posted Monday, April 27, 2009 11:05 PM


Group: General Forum Members
Last Login: Sunday, August 24, 2014 8:31 PM
Points: 15, Visits: 141
As xp_cmdshell is generally not available (unless one enables it, which some companies frown upon), a possible replacement for the code that checks for file existence is using xp_fileexist. Therefore the lines in between "temp proc to check backup file existence" become:

-- START create temp proc to check backup file existence
CREATE PROCEDURE dbo.#prFileExists
@path varchar(300) ,
@p2 int OUTPUT
IF object_id('tempdb..#cmdshell') IS NOT NULL
DROP TABLE #cmdshell
CREATE TABLE #cmdshell ([File Exists] int, [File is a Directory] int, [Parent Directory Exists] int)
INSERT INTO #cmdshell exec master..xp_fileexist @path

SELECT @p2 =[File Exists] from #cmdshell
-- END create temp proc to check backup file existence
Post #705510
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse