LiCongMingDeShujuku / Get-Default-Logins-Quickly-With-SQL

快速获取默认登录信息

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CLEVER DATA GIT REPO

快速获取默认登录信息SQL

Get Default Logins Quickly With SQL

发布-日期: 2018年03月20日 (评论)

#

Contents

中文

这里有一些可以获取在安装时自动创建的默认登录,以及安装完成后创建的默认登录的快速SQL逻辑。它旨在提取在安全设置的第一分钟内创建的所有登录。请注意,默认帐户的创建时间均为11:41(或者更早,如默认的“sa”帐户所示)

请记住,这仅显示在执行传统SQL Server安装时创建的登录,而不使用Reporting Services,Analysis Services等相关服务。

English

Here’s some quick SQL logic which gets you the default logins automatically created at the point of installation, and also those created after the installation was already carried out. It’s designed to pull all logins that were created during the first minute of the security setup. Notice the time of creation of the default accounts are all at 11:41 (or earlier as in the default ‘sa’ account shows) Keep in mind this only shows logins created whenever you perform a traditional SQL Server Installation without associated services such as Reporting Services, Analysis Services etc.


Logic

use master;
set nocount on
 
-- get date when sql server was installed
-- 获取安装sql server的日期
declare @install_date       datetime = (select [createdate] from syslogins where [sid] = 0x010100000000000512000000)
declare @default_accounts   datetime = (select dateadd(minute, 1, @install_date))
 
-- get all logins not associated with the installed accounts
-- 获取与已安装帐户无关的所有登录
select [createdate], [name] from syslogins where [createdate] > @default_accounts
 
-- get all default logins created during installation.
-- 获取安装期间创建的所有默认登录。
select [createdate], [name] from syslogins where [createdate] < @default_accounts

WorksEveryTime

Build-Info

Build Quality Build History
Build-Status
Coverage
Nuget
Build history

Author

  • 李聪明的数据库 Lee's Clever Data
  • Mike的数据库宝典 Mikes Database Collection
  • 李聪明的数据库 "Lee Songming"

Gist Twitter Wordpress


License

LicenseCCSA

Lee Songming

About

快速获取默认登录信息