MSSQL, Configurar XP_CMDSHELL
Script para habilitar y deshabilitar la funcion de xp_cmdshell
-- To allow advanced options to be changed. EXECUTE sp_configure 'show advanced options', 1; GO -- To update the currently configured value for advanced options. RECONFIGURE; GO -- To enable the feature. EXECUTE sp_configure 'xp_cmdshell', 1; GO -- To update the currently configured value for this feature. RECONFIGURE; GO --*******************DESHABILITAR************************* -- To enable the feature. EXECUTE sp_configure 'xp_cmdshell', 0; GO -- To update the currently configured value for this feature. RECONFIGURE; GO -- To allow advanced options to be changed. EXECUTE sp_configure 'show advanced options', 0; GO RECONFIGURE; GO
-- To allow advanced options to be changed. EXEC sp_xp_cmdshell_proxy_account 'domain\user1','users1 Windows password' EXEC sp_xp_cmdshell_proxy_account 'domain\user2','users2 Windows password'
Aplicar permisos para que pueda ejecutar cmdshell
GRANT EXECUTE ON xp_cmdshell TO [BATTA-NET\User]
Verificar si esta habilitado xp_cmdschell
Use master EXEC SP_CONFIGURE 'xp_cmdshell';
Lista de usuarios con permisos
--usuarios que tienen habiilitado Use master EXEC sp_helprotect 'xp_cmdshell'