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?
Create a new script and copy and paste in the code. The next step is to create a Syncro Asset Custom field by going to Admin Settings and Under the Customer Section on the left Nav there is a Asset Custom Field option. Create a Text Field under Syncro Devices
Anyone who need help, regarding implementing the Jimmie script in Syncro and storing the names of all local admin users to a custom field. You can do the following. Once you have something in custom field, you can then generate alert or ticket.
NOTE: This is 100% working script and configured in our Syncro RMM instance. Follow the below steps to implement the solution
NOTE: We will have to create a custom field named “Local Admin” in Syncro. This script will publish all usernames in this field those belongs to Local Admin Group in the system.
NOTE: It’s essential that the field name must be exactly “Local Admin” with a space, as any deviation will prevent the script from functioning correctly because the custom filed name is specified in the Jimmie script.
To implement, please follow these steps:
Create a new script in Syncro by copying and pasting the code provided above.
In the Syncro Admin Settings, navigate to the Customer Section in the left-hand side-bar and click on “Asset Custom Field”
Now under the “Syncro Devices” by clicking on it, create a new custom field, type as a “Text Field” and name it “Local Admin”, ensuring the exact name of custom field including the space.
Thats All, run the script. After script has completed, it will publish all users in the custom field those belongs to system “Local Admin Group”
You can run this script on all customers, all computers using policy. I am sure you can also generate the alert / email from the custom field.
Script To Delete Users From Local Admin Group With Exception
Remove All Users (Domain Users / Local Users) From Local Admin Group With Exception. Just Check Your power-shell Version etc… if Any Issue. This is working script in our environment.
Here i am deleting all users from local admin group (Domain Users / Non Domain Users (Local System Users)) using script expect Local Administrator & also maintaining (Not Deleting) MSP Administrator (NAdmin). You can also maintain another admin if you want by modifying the script.
Hey just a tip @Prabhpal_Singh , you will want to use the “” tag around your code. Other wise, its not formatted correctly and might lead to some issues later.
Here i am disabling all users expect Administrator and re enabling “NAdmin” local User. I did not know the command to preserve NAdmin user with one command, so this is kind of work around but working just fine. If anyone know how to preserve administrator and NAdmin in same command, please update here.
I want to extend my appreciation for the important role that you and your team play in creating and maintaining our SyncroMSP community. Your efforts have been instrumental in making this community thrive.
#Special thanks to Daniel Hedges and Travis for giving us this scripts.
As we move forward with the development.
As explained above, the Jimmie script retrieves all users who are part of the local administrator group.
As explained above how to create a custom field titled “Local Admin” in Syncro to store the users names those are part of local administrator group using Jimmie script above.
If you run the script at this point, it will publish the user names of those who are part of the local administrator group in the “Local Admin” custom field created earlier explained above.
Then Travis took initiative and assisted us in creating a command (script) to disable all users who belong to the local administrator group, except for the accounts we want o preserve - “Administrator” and “NAdmin”
Once this is completed, the process could be considered finished. However, if there is interest in further development, we can proceed to generate alerts in Syncro and create tickets accordingly.
We need to define the requirements to support this development (Generate alerts in Syncro ). Key requirements include:
We will have to create a platform variable in Syncro named “localadmins”.
Developing a script to implement the alert functionality.
To create the platform variable in Syncro, follow these steps:
Log in to your Syncro instance.
Navigate to the Admin section and click on Scripts.
Click on New Script.
Provide a name and description for your script.
Click the “Add Script Variable” button.
In the Variable Name field, type “localadmins” (WITHOUT QUOTES (“”)) AND ensure accuracy with the spelling of Variable name
Select Platform as the Variable Type.
In the Value field, enter or select {{asset_custom_field_local_admin}}
Copy and paste the script provided below into the corresponding field.
Schedule Set the Local Admin Asset field BEFORE you run the script that checks the field and creates and alert. That way the field is up to date. Schedule this script to run once a week on Monday at 8am and second script at 10am.
In this single community post, We have successfully implemented a solution to identifying unauthorized local administrators, automate the process of disabling them, deleting them if, and generate alerts within Syncro.