Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to be able to remotely monitor the disk space on a SQL 2005 server. To do this I need to give a sql server user the ability to run the following stored procedure:

EXEC xp_fixeddrives;

Ideally this user wouldn't have permission to run other stored procedures or do much of anything else.

The new user I just created currently doesn't have permission to run the stored procedure at all. What is the best way to give the user permission to do this and nothing else?

share|improve this question
up vote 1 down vote accepted

xp_fixeddrives is an undocumented procedure. So basically, it doesn't exists. the is no documented way to grant, deny or revoke any permission on it and the result of executing it can be basically anything.

That being said, you can try to wrap the XP in an ordinary procedure, then use code signing to grant the needed permissions to the procedure, then grant EXEC to your user on the wrapper, similar to the example in my blog: Signing an activated procedure. This works on my machine. Your mileage may vary, as is the case anytime you use undocumented functionality:

use master;

create procedure usp_fixeddrives
with execute as caller
  exec xp_fixeddrives;

grant execute on usp_fixeddrives to [low_priviledged_user];

create certificate [usp_fixeddrives]
  encryption by password = 'AnyPassword@1234!'
  with subject = N'usp_fixeddrives'
  , start_date = '11/05/2009';

add signature to [usp_fixeddrives]
  by certificate [usp_fixeddrives]
    with password ='AnyPassword@1234!';

create login [usp_fixeddrives] from certificate [usp_fixeddrives];

grant authenticate server to [usp_fixeddrives];
grant control server to [usp_fixeddrives];

alter certificate [usp_fixeddrives] remove private key;
share|improve this answer

Should be able to to do:

grant execute on xp_fixeddrives to username


share|improve this answer
I get: "Msg 15151, Level 16, State 1, Line 1 Cannot find the user 'dforgac', because it does not exist or you do not have permission." I am logged in as a server administrator using Windows Authenticaiton so I should have permission. The username exists. – Dave Forgac Nov 6 '09 at 19:35
You'll first need to add the login as a user to the master database. – squillman Nov 6 '09 at 19:42
Thanks! I added the public role on the master database to the user and then was able to set the permissions as above. – Dave Forgac Nov 6 '09 at 20:13
Well the permissions were applied without error but now when I execute xp_fixeddrives as the new user I get 0 results. – Dave Forgac Nov 6 '09 at 20:26

You'll need to use EXECUTE AS for this in SQL 2005, and (I think) impersonate a sysadmin who's also an admin for the physical server. A regular user has no rights to the file system, hence no results. In SQL 2000, simply granting them rights to the SP would have worked.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.