Grailman
asked on
Hard drive info
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?
ASKER
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The machine your working on, does that mean the machine that is running SQL Server
ASKER
The two procs
xp_fixeddrives
xp_availablemedia
get the free space alright but I also need space used as well.
xp_fixeddrives
xp_availablemedia
get the free space alright but I also need space used as well.
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.
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.
ASKER
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.
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.
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...