Category filter

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

A user belonging to the ‘Users’ group does not have complete access to the device. Suppose you want to enable administrator privileges for a user. You can easily get it done by writing commands to remove the users from the ‘Users’ group and add them to the ‘Administrators’ group. These commands can be embedded in a script, and you can run them directly from Hexnode using the Execute Custom Scripts action.

Disclaimer:


The sample scripts provided below are adapted from third-party open-source sites.

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

Batch script to change a non-admin Azure domain account user to an admin user

To grant admin rights:

To revoke admin rights:

Replace SAMName with the username of the Azure domain account.

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

Exception:

After executing the .ps1 file in Hexnode, if you come across 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.

Notes:

  • 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