I am interested in finding out who has local admin rights on workstations. But when I also tried to get the host names of the machines where those users are found, I get the singular expression is required error. I understand why I get this error since there are multiple local admin users on each workstation. Is there a syntax I can use to get a result like:
usera - host1
userb - host1
userc - host2
userd - host3
usere - host3
userf - host3
q: if exists (local group “Administrators”) then (members of local group “Administrators” as string & " - " & hostnames as string) else (“No Local Admin Group”)
The issue you had is with concatenation “&”. Doing something like the example below with “it” can help get that style of result.
if (exists local group “Administrators”) then (it & " - " & (hostname)) of (members of local group “Administrators” as string) else (“No Local Admin Group”)
For me… I would just use what noah posted. Your analysis will show what host it came from.