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 select 'drive' = drive , 'gb free' = mbfree / 1024 from #get_drive_info order by drive asc
Categories: Agent Jobs, Alerts, Automations, Backup & Restore, Command Prompt, Database Mail, Database Mirroring, ELI5, Error Solutions, Featured, Folder System, Forensics & Auditing, High Availability, Long Scripts, Management Studio, Notification, Powershell, Quick Fix, Scripts, Security, Short Scripts, SQL Stuff, TSQL, Work Arounds