Agent Jobs

Get Drive Info With Xp_FixedDrives

Here’s some quick logic which takes the results from xp_fixed drives, and puts it in a table. Then a quick query against that tables shows the amount of free space in GB. It’s quick, and simple. Those are the best ones.

use master;
set nocount on
if exists (select object_id('tempdb..#get_drive_info'))
drop table #get_drive_info

create table #get_drive_info
  drive char(1) not null
, mbfree int not null
insert into #get_drive_info
exec xp_fixeddrives

  'drive' = drive
, 'gb free' = mbfree / 1024
order by
drive asc


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s