Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Hard drive info

Posted on 2000-04-12
7
Medium Priority
?
503 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
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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.
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

636 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