Script to report if user has admin rights?

Does anyone know of a script or a simple method to determine en masse which of my users in Syncro have admin rights on their machines? It has recently come to my attention that we may have left some end users with admin rights during onboarding and I want to see how many there are.

I used ChatGpt to create a script that will check and I can manually look for the script results, but I would rather have it write to a custom asset field and I can never figure that part out, even using the little guide at the bottom of the scripts.

Before I pour hours down this rabbit hole is there a more obvious option I am missing?

1 Like

This is what I use, and it writes to a custom field.

Import-Module $env:SyncroModule

$obj_group = [ADSI]"WinNT://localhost/Administrators,group"
$members= @($obj_group.psbase.Invoke("Members")) | foreach{([ADSI]$_).InvokeGet("Name")}

Set-Asset-Field -Name "Local Admin" -Value $members
3 Likes

Excellent thanks for the help .That worked perfectly!

Looks super interesting! Can some one tell me where and how i put this in Syncromsp to automate it! Thanks.