Ok guys, my turn. I wanted to see if any of you know how to get drive space (like using xp_fixeddrives) for all linked servers. I want to pull that info into one table on one server. I know I can do this using openquery, but the thing is that the linked server logins would have to be sysadmin for any results tobe returned (in a 2005 environent). any thoughts? I do not want to have the linked servers to have sysadmin rights. Mike
[quote user="MichaelB"] Oh well. I guess no one knows[/quote] Well, this is one of the procs that is regarded as 'dangerous' from a security standpoint. The question may well be, do we want anyone to be able to gather info about the drives? ...or is it something that only users of sufficient level (and thus also presumably trusted) should be able to get? I don't know for sure, but I think that the user needs o/s level permissions, since it's the o/s that supplies the information through xp_fixeddrives /Kenneth
.. absolutely the change of security features introduced in SQL 2005 will have such breakup of scripts that weren't documented before, another best example for not using undocumented stored procedures [}.
Yah, the linked servers are 2005. I think it should be able to give disk space. sigh. I understand it may be an all or nothing proposition. Not a critical thought. Are there any DMVs I can use maybe??
Hmm... Well, I think that you may need to go outside SQL Server, since after all, the drives isn't within SQL Server's domain anyway. All that is handled by the o/s. What about WMI? /Kenneth
IF the associated servers are 2005 then you could make use of EXECUTE AS process in order to get complete information, also in case of using DMVs on multiple serves.
Kenneth - I will look into WMI Satya - I tried that and got the same error. I thought it would work too!
Hmm, it works for me. Try using the following script and create in relevant SQL Server to extract required information using EXECUTE AS method: CREATE TABLE #fix (Drive NVARCHAR(5), MBFree INT) INSERT INTO #fix EXEC xp_fixeddrives SELECT * FROM #fix SELECT SUM(MBFree) AS SumMBFree FROM #fix.
There's also another aspect that came to mind. All the xp_* procs are on the 'do not use for new development' list, since they're all targeted for deprecation. What about writing one's own CLR-proc to replace xp_fixeddrives? This is something that's been suggested to MS to provide as replacement, but while we're waiting it may be worth looking into..? /Kenneth
Oh yes it is better to keep away or depending upon undocumented procedures, this is another example what you will get when it has been working well for ages. See relevant topic in http://www.sqlservercentral.com/Forums/Topic113227-5-1.aspx#bm122603 which might another way to accomplish. I would also agree to look into CLR procedures to keep it running in future versions.
[quote user="satya"] Hmm, it works for me. Try using the following script and create in relevant SQL Server to extract required information using EXECUTE AS method: CREATE TABLE #fix (Drive NVARCHAR(5), MBFree INT) INSERT INTO #fix EXEC xp_fixeddrives SELECT * FROM #fix SELECT SUM(MBFree) AS SumMBFree FROM #fix. [/quote] This does not work for me. I get empty rowsets. I create a SP with execute as CALLER. correct?