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 the administrator privileges to 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 it directly from Hexnode using the Execute Custom Scripts action.
Batch Script to change a non-admin user to an admin user
1 2 3 4 5 6 7 8 9 10 11 |
Rem Step 1: Add the user to the Administrators group. NET LOCALGROUP Administrators Username /ADD Rem Step 2: Remove the user from the Users group NET LOCALGROUP Users Username /DELETE Rem Step 3 (Optional): List the users belonging to Administrators or Users group NET LOCALGROUP Groupname |
Powershell Script to change a non-admin user to an admin user
1 2 3 4 5 6 7 8 9 10 11 |
#Step 1: Add the user to the Administrators group Add-LocalGroupMember –Group “Administrators” -Member “Username” #Step 2: Remove the user from the Users group: Remove –LocalGroupMember –Group “Users” -Member “Username” #Step 3: (Optional): List the users belonging to Administrators or Users group Get-LocalGroupMember –Group “Groupname” |
Need more help?