Rudy,
Thanks for sharing this excellent script. I ran into one small issue and got this error:
Msg 15281, Level 16, State 1, Procedure sysmail_help_status_sp, Line 0
SQL Server blocked access to procedure 'dbo.sysmail_help_status_sp' of component 'Database Mail XPs' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Database Mail XPs' by using sp_configure. For more information about enabling 'Database Mail XPs', see "Surface Area Configuration" in SQL Server Books Online.
This was because Database Mail was not enabled.
I corrected this by adding a simple IF statement around the INSERT statement. So it went from this:
CREATE TABLE #Database_Mail_Details
(Status NVARCHAR(7))
INSERT INTO #Database_Mail_Details (Status)
Exec msdb.dbo.sysmail_help_status_sp
To this:
CREATE TABLE #Database_Mail_Details
(Status NVARCHAR(7))
IF EXISTS(SELECT * FROM master.sys.configurations WHERE configuration_id = 16386 AND value_in_use =1)
BEGIN
INSERT INTO #Database_Mail_Details (Status)
Exec msdb.dbo.sysmail_help_status_sp
END
You also had the the outputs for Section 7 (Last Backup Dates) and section 8 (List of SQL Jobs) reversed.
Thanks again for taking the time to share this script.
Lee