?
Solved

Hard drive info

Posted on 2000-04-12
7
Medium Priority
?
501 Views
Last Modified: 2012-08-14
I'm new to SQL and want to write a stored proc that will allow me to get info about the machine I'm working on. I want to get: 1) partition size(s) of the hard drive as well and 2) total space occupied by files in directory a directory. I know I can do a xp_cmdshell ‘dir c:\xyz’ but this is for many remote machines in our system and I really don't need all the information a ‘dir’ or ‘chkdisk’command would return. Any suggestions?
0
Comment
Question by:Grailman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 4

Expert Comment

by:mitek
ID: 2708403
check out these stored procedures:

xp_fixeddrives

xp_dirtree

xp_subdirs

sp_spaceused


also, you can read values directly from registry. this is probably the most precise way to find out the sizes of partitions and just about any information about the machine...
0
 
LVL 1

Author Comment

by:Grailman
ID: 2708467
Thanks for the quick reply.

I'm using SQL7 but I couldn't find these three:
   xp_fixeddrives
   xp_dirtree
   xp_subdirs

and this one:
   sp_spaceused

looks like it is only for db info. I actually need to query file info.
0
 
LVL 4

Accepted Solution

by:
Gustavo Perez Buenrostro earned 600 total points
ID: 2708508
Grailman,

As mitek suggested you could use these extended stored procedures to get the information you request. Note you should be careful when using undocumented extended stored procedures because there are no info and helpful hints available on how to use them.

You can get a complete list of some undocumented extended stored procedures at:

http://www.winntmag.com/Files/3539/Table_01.html

PD: Let me know if you need advice on how to use them.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:simonsabin
ID: 2708520
The machine your working on, does that mean the machine that is running SQL Server
0
 
LVL 1

Author Comment

by:Grailman
ID: 2709147
The two procs
   xp_fixeddrives
   xp_availablemedia

get the free space alright but I also need space used as well.
0
 
LVL 4

Expert Comment

by:mitek
ID: 2711979
gpbuenrostro -- thanks for the link.

ok. i sort of had left my answer unfinished. my idea was to read the values from nt registry using some of those undocumented sp from gpbuenrostro's link.

sorry, i'm not an nt guru, so i don't know where exactly the free/used space parameters are located in the registry; this goes beyond the area of sql server expertise. but i think my idea is clear.



0
 
LVL 1

Author Comment

by:Grailman
ID: 2712090
gpbuenrostro:
Thanks for the link. This does not fully work in my current situation but those are some great stored procedures that I know I'll use.

mitek:
I don't think that these parameters are actually in the registry. I've searched in it for free, partition & space but have not been able to find them :-( Thanks anyway.

0

Featured Post

Introducing Priority Question

Increase expert visibility of your issues by participating in Priority Question, our latest feature for Premium and Team Account holders. Adjust the priority of your question to get emergent issues in front of subject-matter experts for help when you need it most.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question