You are on page 1of 2

SELECT SERVERPROPERTY('ProductLevel') as SP_installed,

SERVERPROPERTY('ProductVersion') as Version;

select name , is_disabled from sys.server_principals


where sid = 0x01
and is_disabled = 0

select principal_id, Name from sys.server_principals


where name = 'sa'

select SERVERPROPERTY('IsIntegratedSecurityOnly') as [login_mode]

select DB_NAME() as DatabaseName, 'guest' as DatabaseUser, [permission_name],


[state_desc]
from sys.database_permissions
where [grantee_principal_id] = DATABASE_PRINCIPAL_ID('guest')
and [state_desc] like 'GRANT%'
and [permission_name] = 'CONNECT'
and DB_NAME() NOT IN ('master', 'tempdb', 'msdb')

SELECT * FROM master.sys.sql_logins

SELECT * FROM master.sys.syslogins

--select * from sys.credentials

select * from sys.server_principals

select * from sys.database_permissions

select * from sys.configurations

SELECT * FROM sys.procedures;

SELECT * FROM sys.objects WHERE type = 'P';

select * from sys.triggers

exec sp_linkedservers

SELECT * FROM sys.Servers a LEFT OUTER JOIN sys.linked_logins b ON b.server_id =


a.server_id LEFT OUTER JOIN sys.server_principals c ON c.principal_id =
b.local_principal_id

select I.[name], 'sysadminmembership' as 'AccessMethod'


from sys.sql_logins as I
where IS_SRVROLEMEMBER('sysadmin', name) = 1 and I.is_expiration_checked<>1
union all
select I.[name], 'CONTROLSERVER' as 'AccessMethod'
from sys.sql_logins as I
join sys.server_permissions as p
on I.principal_id = p.grantee_principal_id
where p.type = 'CL'
and p.state in ('G', 'W')
and I.is_expiration_checked <>1

select name, is_disabled from sys.sql_logins


where is_policy_checked = 0
SELECT name,
CAST('value' as int) as value_configured, CAST('value_in_use' as int) as
value_in_use
from sys.configurations
where name ='remoteaccess'

SELECT name,
CAST('value' as char) as value_configured, CAST('value_in_use' as char) as
value_in_use
from sys.configurations
where name = 'Database Mail XPs'

select * from sys.configurations


where [name] = 'Database Mail XPs'

select * from sys.configurations


where [name] = 'remoteaccess'

You might also like