You'll see this parameter in a lot of our SPs. It returns the schema and call for that SP.
The idea is simple. We want Minion to be as useful as possible and we want you to be able to extend it to your own needs. Therefore, being able to get info quickly is essential. The only problem is that many of the resultsets returned are very wide so calling them from your own code can be quite a dev effort. So to ease this, we give you the @ReturnSchema param.
It returns a #table with all the cols of the resultset along with the call to fill the #table. This will greatly help you in your efforts to use our existing code to develop your own processes.
Here's an example:
EXEC [Report].[SQLAdminsGetAll] @ReturnSchema = 1;
Returns:
CREATE TABLE #ADSQLUsers( [ExecutionDateTime] [datetime] NULL, ServerName VARCHAR(150), [SQLAcctInstanceID] [bigint] NULL, [ADAcctGroupName] [nvarchar](200) NULL, [ADAcctObjectName] [nvarchar](200) NULL, [ADAcctIsGroup] [bit] NULL, [ADAcctGroupMember] [varchar](100) NULL, [ADAcctLastLogon] [datetime] NULL, [ADAcctBadLogonCount] [bigint] NULL, [ADAcctPasswordNeverExpires] [bit] NULL, [ADAcctPasswordNotRequired] [bit] NULL, [ADAcctPermittedLogonTimes] [varchar](1000) NULL, [ADAcctPermittedWorkstations] [varchar](max) NULL, [ADAcctLastPasswordSet] [datetime] NULL, [ADAcctLastBadPasswordAttempt] [nchar](10) NULL, [ADAcctUserCannotChangePassword] [nchar](10) NULL, [ADAcctDescription] [nvarchar](max) NULL, [ADAcctDelegationPermitted] [bit] NULL, [ADAcctAccountExpirationDate] [datetime] NULL, [ADAcctAccountLockoutTime] [datetime] NULL, [ADAcctEmailAddress] [nvarchar](500) NULL, [ADAcctEnabled] [bit] NULL, [ADAcctEmployeeID] [nvarchar](200) NULL, [ADAcctVoiceTelephoneNumber] [varchar](100) NULL, [ADAcctDistinguishedName] [nvarchar](2000) NULL, [ADAcctDisplayName] [nvarchar](2000) NULL, [ADAcctSurName] [nvarchar](100) NULL, [ADAcctMiddleName] [nvarchar](100) NULL, [ADAcctGivenName] [nvarchar](100) NULL, [ADAcctName] [nvarchar](200) NULL, [ADAcctGUID] [varchar](200) NULL, [ADAcctSID] [varchar](200) NULL, [ADAcctSmartcardLogonRequired] [nchar](10) NULL, [ADAcctHomeDirectory] [nvarchar](2000) NULL, [ADAcctHomeDrive] [nvarchar](2000) NULL, [ADAcctAllowReversiblePasswordEncryption] [bit] NULL, [SQLAcctSID] [varbinary](85) NULL, [SQLAcctstatus] [smallint] NULL, [SQLAcctcreatedate] [datetime] NULL, [SQLAcctupdatedate] [datetime] NULL, [SQLAcctaccdate] [datetime] NULL, [SQLAccttotcpu] [int] NULL, [SQLAccttotio] [int] NULL, [SQLAcctspacelimit] [int] NULL, [SQLAccttimelimit] [int] NULL, [SQLAcctresultlimit] [int] NULL, [SQLAcctname] [sysname] NULL, [SQLAcctdbname] [sysname] NULL, [SQLAcctpassword] [varbinary](max) NULL, [SQLAcctlanguage] [sysname] NULL, [SQLAcctdenylogin] [int] NULL, [SQLAccthasaccess] [int] NULL, [SQLAcctisntname] [int] NULL, [SQLAcctisntgroup] [int] NULL, [SQLAcctisntuser] [int] NULL, [SQLAcctsysadmin] [int] NULL, [SQLAcctsecurityadmin] [int] NULL, [SQLAcctserveradmin] [int] NULL, [SQLAcctsetupadmin] [int] NULL, [SQLAcctprocessadmin] [int] NULL, [SQLAcctdiskadmin] [int] NULL, [SQLAcctdbcreator] [int] NULL, [SQLAcctbulkadmin] [int] NULL, [SQLAcctloginname] [sysname] NULL, [SQLAcctBadPasswordCount] [int] NULL, [SQLAcctBadPasswordTime] [datetime] NULL, [SQLAcctHistoryLength] [datetime] NULL, [SQLAcctPasswordLastSetTime] [datetime] NULL, [SQLAcctPasswordHash] [varchar](50) NULL, [SQLAcctLoginType] [varchar](50) NULL, [SQLAcctDateLastModified] [datetime] NULL, [SQLAcctIsDisabled] [bit] NULL, [SQLAcctIsLocked] [bit] NULL, [SQLAcctIsPasswordExpired] [bit] NULL, [SQLAcctIsSystemObject] [bit] NULL, [SQLAcctLanguageAlias] [varchar](50) NULL, [SQLAcctMustChangePassword] [bit] NULL, [SQLAcctPasswordExpirationEnabled] [bit] NULL, [SQLAcctPasswordPolicyEnforced] [bit] NULL, [SQLAcctState] [varchar](50) NULL, [SQLAcctWindowsLoginAccessType] [varchar](50) NULL, [SQLAcctDefaultDatabase] [varchar](150) NULL, --[MoreInfo] varchar(500), LimitBy varchar(20), LimitParam varchar(20), AdminType varchar(20) ); INSERT INTO #ADSQLUsers ( ExecutionDateTime, SQLAcctInstanceID, ServerName, SQLAcctSID, SQLAcctname, SQLAcctLoginType, ADAcctGroupName, ADAcctObjectName, ADAcctIsGroup, ADAcctGroupMember, ADAcctLastLogon, ADAcctBadLogonCount, ADAcctPasswordNeverExpires, ADAcctPasswordNotRequired, ADAcctPermittedLogonTimes, ADAcctPermittedWorkstations, ADAcctLastPasswordSet, ADAcctLastBadPasswordAttempt, ADAcctUserCannotChangePassword, ADAcctDescription, ADAcctDelegationPermitted, ADAcctAccountExpirationDate, ADAcctAccountLockoutTime, ADAcctEmailAddress, ADAcctEnabled, ADAcctEmployeeID, ADAcctVoiceTelephoneNumber, ADAcctDistinguishedName, ADAcctDisplayName, ADAcctSurName, ADAcctMiddleName, ADAcctGivenName, ADAcctName, ADAcctGUID, ADAcctSID, ADAcctSmartcardLogonRequired, ADAcctHomeDirectory, ADAcctHomeDrive, ADAcctAllowReversiblePasswordEncryption, SQLAcctstatus, SQLAcctcreatedate, SQLAcctupdatedate, SQLAcctaccdate, SQLAccttotcpu, SQLAccttotio, SQLAcctspacelimit, SQLAccttimelimit, SQLAcctresultlimit, SQLAcctdbname, SQLAcctpassword, SQLAcctlanguage, SQLAcctdenylogin, SQLAccthasaccess, SQLAcctisntname, SQLAcctisntgroup, SQLAcctisntuser, SQLAcctsysadmin, SQLAcctsecurityadmin, SQLAcctserveradmin, SQLAcctsetupadmin, SQLAcctprocessadmin, SQLAcctdiskadmin, SQLAcctdbcreator, SQLAcctbulkadmin, SQLAcctloginname, SQLAcctBadPasswordCount, SQLAcctBadPasswordTime, SQLAcctHistoryLength, SQLAcctPasswordLastSetTime, SQLAcctPasswordHash, SQLAcctDateLastModified, SQLAcctIsDisabled, SQLAcctIsLocked, SQLAcctIsPasswordExpired, SQLAcctIsSystemObject, SQLAcctLanguageAlias, SQLAcctMustChangePassword, SQLAcctPasswordExpirationEnabled, SQLAcctPasswordPolicyEnforced, SQLAcctState, SQLAcctWindowsLoginAccessType, SQLAcctDefaultDatabase--, MoreInfo ) EXEC Report.SQLAdminsGetAll @AdminType = 'sysadmin'; SELECT * FROM #ADSQLUsers;
By simply pasting this code into your own routine you can easily call our SPs and do anything you like with the data.