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

check if xp_cmdshell is enabled Expand / Collapse
Author
Message
Posted Thursday, July 8, 2010 9:29 AM
Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: 2 days ago @ 4:09 AM
Points: 761, Visits: 1,083
Hi,

I'm doing a stored procedure that will enable xp_cmdshell, if it is not enabled yet, on the SQL Server 2005 instance.

I have the code belloe, to put inside the stored proc (so that it enables the
xp_cmdshell), but , befour i run this commands i need to know if the option is not already enabled.

How can i do this?

Thank you

EXEC sp_configure ‘show advanced options’, 1
– To update the currently configured value for advanced options.
RECONFIGURE

– To enable the feature.
EXEC sp_configure ‘xp_cmdshell’, 1

– To update the currently configured value for this feature.
RECONFIGURE

Post #949389
Posted Thursday, July 8, 2010 9:38 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 2:35 PM
Points: 12,962, Visits: 32,498
river i don't think you need to check it before hand , just change it...

if xp_cmdshell is already enabled you just get this message anyway:

Configuration option 'xp_cmdshell' changed from 1 to 1. Run the RECONFIGURE statement to install.


so i would have my process change the value no matter what, do it's thing, and then change it back.


Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #949398
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse