Hopefully this is the correct forum please move if not..
I'm trying to write a custom condition to use in policy based management that will be executed against several servers and report back those that have SQL agent jobs where 'sa' is not the owner.
ExecuteSql('string', 'SELECTsv.name AS [Name],
sv.job_id AS [JobID],
l.name AS UserName
FROM
msdb.dbo.sysjobs_view AS sv
INNER JOIN [master].[sys].[syslogins] l ON sv.owner_sid = l.sid
WHERE L.name <> ''sa''
ORDER BY
sv.[Name] ASC')
I enter the above in the Field with an Operator of = and Value 1 under the Server Facet and it complains that the input string is incorrect. I also get an error of "Make sure string constants are enclosed in single quotes and facet properties are prefixed with '@' sign."