Category filter

Script to change admin user to non-admin user in Windows

A user belonging to the ‘Administrators’ group has complete and unrestricted access to the device. Suppose you want to revoke the administrator privileges of a user to prevent them from making system-wide changes. You can easily get it done by writing commands to remove the users from the ‘Administrators’ group and add them to the ‘Users’ group. These commands can be embedded in a script, and you can run it directly from Hexnode using the Execute Custom Scripts action.


The Sample Scripts provided below are adapted from third-party Open-Source sites.

Batch file script to change an admin user to a non-admin user

PowerShell script to change an admin user to a non-admin user


After executing the .ps1 file from the Hexnode, if you come across as an output such as “command is not recognized” in the Action History, add this to the beginning of the file, followed by the steps 1 and 2.


  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

  • Sample Script Repository