SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


check if xp_cmdshell is enabled


check if xp_cmdshell is enabled

Author
Message
river1
river1
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8310 Visits: 1521
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
Lowell
Lowell
SSC Guru
SSC Guru (138K reputation)SSC Guru (138K reputation)SSC Guru (138K reputation)SSC Guru (138K reputation)SSC Guru (138K reputation)SSC Guru (138K reputation)SSC Guru (138K reputation)SSC Guru (138K reputation)

Group: General Forum Members
Points: 138927 Visits: 41520
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
--help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search