Created
April 18, 2016 18:54
-
-
Save davops/2847b03c6acb9c7527a2b21fcd765eb8 to your computer and use it in GitHub Desktop.
This query looks through all databases for objects using the xp_cmdshell command. The original select query originally came from: http://stackoverflow.com/questions/2833389/finding-all-stored-procedures-calling-a-function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXEC sp_MSForEachDB ' Use [?]; SELECT DB_NAME() AS ''Database Name''; | |
Select * | |
FROM sys.sql_modules m | |
INNER JOIN sys.objects o ON m.object_id=o.object_id | |
INNER JOIN sys.schemas s ON o.schema_id=s.schema_id | |
WHERE m.definition Like ''%xp_cmdshell%'' | |
ORDER BY 1' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment