I am trying to query on the "Members" field in the "Local Users and Groups" > "Local Groups" branch in a device. I'd like a query to return everything with "DisplayName\" in it, which I think should show me every computer with a local user account. I understand this will be basically all computers, because they all have a local Administrator account... but I'd like to use this to be a foundation for other reports. My SQL knowledge is limited. I think the following is close, but I could use some help. I found the "CONCAT" statement online.
SELECT DISTINCT A0.DISPLAYNAME AS "Device Name", A1.NAME AS "Name", A1.MEMBERS AS "Members"
FROM Computer A0 (nolock) LEFT OUTER JOIN LocalGroups A1 (nolock) ON A0.Computer_Idn = A1.Computer_Idn
WHERE (A1.NAME = N'Administrators' AND A1.MEMBERS LIKE CONCAT('%', A0.DISPLAYNAME ,'\%'))
ORDER BY A0.DISPLAYNAME
Am I close? The report I am creating returns an error that concat is not a recognized built-in function name when I attempt to validate the SQL code.
Thanks in advance!