Just getting this out there for folks to benefit from... this query could use some more love, but the nuts and bolts are there to get you started. Just simply edit the last lines for the text you're searching for and you're off to the races...
Edit 04/08/2021: I realized my original SWQL was littered with issues so much so that I had to update it. Added a couple comments in there as well and cleaned up the query but to sum it up, I was looking in the wrong tables for the data, and the true componenttype is 45 for a powershell script component. The new query below will pull the overridden value of the script (if configured), else pull the script as defined in the template.
-- SWQL Query to show powershell component monitors SELECT c.Application.Node.Caption AS [Node Caption], c.Application.Node.IP_Address AS [Node IP], c.ComponentDefinition.DisplayName AS [Component Type], c.Name AS [ComponentName], c.Application.Name AS [Application Name], c.ComponentID AS [ComponentID], c.ApplicationID AS [AppID], c.Application.Template.ApplicationTemplateID AS [AppTemplateID], ISNULL(es1.Setting, es2.Setting) AS [ScriptBody] FROM Orion.APM.Component AS c LEFT JOIN Orion.APM.ComponentSetting AS cs ON ( cs.ComponentID = c.ComponentID AND cs.Key = 'ScriptBody' ) -- This is where overridden script bodies are stored LEFT JOIN Orion.APM.ComponentTemplateSetting AS cts ON ( c.TemplateID = cts.ComponentTemplateID AND cts.Key = 'ScriptBody' ) -- This is where the template script bodies are stored LEFT JOIN Orion.APM.ExternalSetting AS es1 ON es1.ID = cs.Value LEFT JOIN Orion.APM.ExternalSetting AS es2 ON es2.ID = cts.Value WHERE c.ComponentType = 45 AND ( es1.Setting LIKE '%SEARCHSTRING%' OR es2.Setting LIKE '%SEARCHSTRING%' )
Hope others find this useful. Cheers!