Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
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: Today @ 1:25 PM
Points: 38,971, Visits: 36,056
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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Favorite Quotes:
"Has anyone ever told you that a query you have written runs too fast?" - Dwain Camps - 6 Mar 2014

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, October 30, 2015 5:10 AM
Points: 192, Visits: 927
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: Friday, November 20, 2015 12:04 PM
Points: 1,871, Visits: 3,520
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