怎么样删除与恢复扩展存储过过程xp_cmdshell的语句?

怎么样删除与恢复扩展存储过过程xp_cmdshell的语句?

删除与恢复扩展存储过过程xp_cmdshell的语句
 

删除扩展存储过过程xp_cmdshell的语句:
exec sp_dropextendedproc 'xp_cmdshell'


恢复cmdshell的SQL语句
EXEC sp_addextendedproc xp_cmdshell ,@dllname ='xplog70.dll'




开启cmdshell的SQL语句

EXEC sp_addextendedproc xp_cmdshell ,@dllname ='xplog70.dll'

判断存储扩展是否存在
Select count(*) from master.dbo.sysobjects where xtype='X' and name='xp_cmdshell'
返回结果为1就OK

恢复xp_cmdshell
Exec master.dbo.addextendedproc 'xp_cmdshell','xplog70.dll';select count(*) from master.dbo.sysobjects where xtype='X' and name='xp_cmdshell'
返回结果为1就OK

否则上传xplog7.0.dll
Exec master.dbo.addextendedproc 'xp_cmdshell','C:/WinNt/System32/xplog70.dll'

堵上cmdshell的SQL语句
sp_dropextendedproc "xp_cmdshell"