日期:2014-05-17  浏览次数:20877 次

Windows Server 2003 忘记密码的一个解决办法。

Windows Server 2003忘记Administrator等用户密码,在其他电脑能连上该电脑的SqlServer2005的情况下的解决办法:使用Sqlserver带的xp_cmdshell命令(扩展存储过程将命令字符串作为操作系统命令 shell 执行,并以文本行的形式返回所有输出,可以执行任何操作系统命令)。

?

两种方式启用xp_cmdshell

1、打开外围应用配置器-> 功能的外围应用配置器->实例名Database Enginexp_cmdshell->启用

2、sp_configure,在Sqlserver的查询窗口执行( 条执行 ):

-- 允许配置高级选项
EXEC sp_configure 'show advanced options', 1
-- 重新配置
RECONFIGURE
-- 启用xp_cmdshell
EXEC sp_configure 'xp_cmdshell', 1
--重新配置
RECONFIGURE
?

--执行用户命令

?

--新建用户名abc,密码pwd的用户
xp_cmdshell 'net user abc pwd /ADD'

--把用户abc加入管理员组
xp_cmdshell 'net localgroup administrators abc /ADD'
?

?

再使用abc登录系统,解决问题。

禁用打开的参数:

-- 允许配置高级选项
EXEC sp_configure 'show advanced options', 1
-- 重新配置
RECONFIGURE
-- 禁用xp_cmdshell
EXEC sp_configure 'xp_cmdshell', 0
--重新配置
RECONFIGURE
?

?