Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase ««12

check diskspace Expand / Collapse
Posted Thursday, November 8, 2012 11:07 AM



Group: General Forum Members
Last Login: Yesterday @ 11:57 PM
Points: 41,646, Visits: 39,001
SGT_squeequal (11/8/2012)
@jeff here you go, save it then rename it to .vbs

Heh... I saw some CDO email in there. You're a man after my own heart. Thanks for posting the code.

--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

Helpful Links:
How to post code problems
How to post performance problems
Post #1382645
Posted Friday, November 9, 2012 8:55 AM


Group: General Forum Members
Last Login: Friday, January 29, 2016 12:11 PM
Points: 192, Visits: 929
If you don't have any mount points, here is a script for using the xp_fixeddrives function. The threshold is set in the if exists line, and sends an email showing all drives with free space below the set threshold. Hope it helps someone.

(DriveLetter char(1),
MBFree int)

EXEC master.dbo.xp_fixeddrives

if exists (SELECT * FROM #DriveSpace WHERE MBFree < 10000) -- value to set threshold at, in MB
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'SQL Server Agent Mail Profile',
@recipients = '',
@query = 'CREATE TABLE #DriveSpace2 (DriveLetter Char(1),MBFree int); INSERT INTO #DriveSpace2 EXEC master.dbo.xp_fixeddrives; SELECT DriveLetter, MBFree FROM #DriveSpace2; DROP TABLE #DriveSpace2' ,
@subject = '<ServerName> - Low Disk Space',
@attach_query_result_as_file = 1 ;
DROP TABLE #DriveSpace
Post #1383070
Posted Friday, November 9, 2012 9:27 AM


Group: General Forum Members
Last Login: Today @ 2:51 PM
Points: 1,976, Visits: 3,707
Thanks much, we don't have mount points. I will give it a try
Post #1383094
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse