复制代码 代码如下:
USE MASTER
GO
DROP TRIGGER trg_logon_attempttest ON ALL SERVER
GO
复制代码 代码如下:
CREATE TRIGGER trg_logon_attempttest
ON ALL SERVER
WITH EXECUTE AS'sa'
FOR LOGON,ALTER_LOGIN
AS
BEGIN
DECLARE
@cmd nvarchar(4000)
SELECT
@cmd = 'ECHO '
+ ORIGINAL_LOGIN()+ CHAR(9) + CONVERT(varchar(100), GETDATE(), 121)
+ ' >> d:/Logondata.txt'
DECLARE @tb_re TABLE(re varchar(4000));
INSERT @tb_re exec master.. xp_cmdshell @cmd
END
GO
复制代码 代码如下:
NT AUTHORITY/SYSTEM 2013-02-08 16:49:04.140
NT AUTHORITY/SYSTEM 2013-02-08 16:49:14.210
NT AUTHORITY/SYSTEM 2013-02-08 16:49:24.277
JOE/Administrator 2013-02-08 16:49:31.753
JOE/Administrator 2013-02-08 16:49:31.963
NT AUTHORITY/SYSTEM 2013-02-08 16:49:34.327
JOE/Administrator 2013-02-08 16:49:35.777
sa 2013-02-08 16:51:39.930
NT AUTHORITY/SYSTEM 2013-02-08 16:52:03.147
NT AUTHORITY/SYSTEM 2013-02-08 16:52:13.337
NT AUTHORITY/SYSTEM 2013-02-08 16:52:23.410
NT AUTHORITY/SYSTEM 2013-02-08 16:52:33.830
NT AUTHORITY/SYSTEM 2013-02-08 16:52:44.703
NT AUTHORITY/SYSTEM 2013-02-08 16:52:54.407
NT AUTHORITY/SYSTEM 2013-02-08 16:52:54.623
NT AUTHORITY/SYSTEM 2013-02-08 16:52:54.797
NT AUTHORITY/SYSTEM 2013-02-08 16:52:54.823
NT AUTHORITY/SYSTEM 2013-02-08 16:52:54.893
NT AUTHORITY/SYSTEM 2013-02-08 16:52:55.147
NT AUTHORITY/SYSTEM 2013-02-08 16:52:55.277
新闻热点
疑难解答