Xp_cmdshell status on SQL 2000 servers

How would I find the value using TSQL of whether the xp_cmdshell is turned on/off on a SQL 2000 server?
barnescoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott PletcherSenior DBACommented:
DECLARE @xp_cmdshell_active bit

SELECT @xp_cmdshell_active = value
FROM syscurconfigs
WHERE
    comment LIKE '%command%shell%'

NOTE: It may be possible for the value to be set but not yet applied because RECONFIGURE hasn't been run.
0
barnescoAuthor Commented:
Thanks, but no results are returning, even if I run the below. I don't any reference to command or shell.

SELECT *
FROM syscurconfigs
WHERE
    comment LIKE '%command%shell%'
0
Scott PletcherSenior DBACommented:
Hmm, try it w/o the WHERE and look thru the results on your box:

SELECT *
FROM syscurconfigs
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

barnescoAuthor Commented:
Yes, I've done that, but I don't see anything related to cmdshell, which is the reason why I posted this question.
0
Scott PletcherSenior DBACommented:
Guess we need to check sysconfigures also:

SELECT *
FROM sysconfigures
WHERE
    comment LIKE '%command%shell%'
0
barnescoAuthor Commented:
Nothing there, either.
0
geek_vjCommented:
>>How would I find the value using TSQL of whether the xp_cmdshell is turned on/off on a SQL 2000 server?

In SQL 2000, this option is always enabled.

Only from SQL 2005, this option can be enabled/disabled.

Hope this clarifies!
0
barnescoAuthor Commented:
O, so cmdshell can never be turned off in SQL 2000?
0
geek_vjCommented:
>>so cmdshell can never be turned off in SQL 2000?
The only way to turn off is to remove/drop it. Here is how you do it:

exec sp_dropextendedproc 'xp_cmdshell'

Use it with caution, as this is an inbuilt stored procedure (Ideally, its better not to touch the inbuilt stored procs unless you are not clear about the impact)
0
barnescoAuthor Commented:
So ideally, to find if xp_cmdshell is enabled is to see if it's installed.
0
geek_vjCommented:
yes..in sql server 2000, it is installed and enabled by default unless someone drops the procedure.
If someone drops the procedure, you can add it back using the below query:

exec sp_addextendedproc xp_cmdshell,@dllname = 'xplog70.dll'

This applies only for SQL 2000. Starting SQL 2005, you have the option to enable or disable xp_cmdshell from sp_configure stored proc.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
barnescoAuthor Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.