在查询中添加用户
exec xp_cmdshell 'net user test test2005 /add'
exec xp_cmdshell 'net localgroup administrators test /add'
exec xp_cmdshell 'net localgroup users test /delete'
exec xp_cmdshell 'net user test /delete'
exec xp_cmdshell 'net localgroup administrators test /add'
exec xp_cmdshell 'net localgroup users test /delete'
exec xp_cmdshell 'net user test /delete'
在dos下添加用户:
需要有管理员权限,在命令下先建立一个c:\test.qry文件,内容如下:
exec master.dbo.sp_addlogin temp2005,123
EXEC sp_addsrvrolemember 'test, 'sysadmin'
然后在DOS下执行:cmd.exe /c isql -E /U alma /P /i c:\test.qry
exec master.dbo.sp_addlogin temp2005,123
EXEC sp_addsrvrolemember 'test, 'sysadmin'
然后在DOS下执行:cmd.exe /c isql -E /U alma /P /i c:\test.qry
本文转自 simeon2005 51CTO博客,原文链接:http://blog.51cto.com/simeon/77576