Rudy, hi!
Regarding this portion of script :
-------------------------------------
--> SQL Server Settings <--
EXEC sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
SELECT
[name]
,[description]
,[value]
,[minimum]
,[maximum]
,[value_in_use]
INTO #SQL_Server_Settings
FROM master.sys.configurations
GO
EXEC sp_configure 'show advanced options', 0;
GO
RECONFIGURE;
GO
----------------------------------------------
There's no need to neither switch advanced options ON, nor OFF, because "select * from master.sys.configurations" will return the same amount of information in both cases.
I mean this option doesn't affect the amount of records returned by select.
Regards,
Andrey.