You can use the net localgroup command and specify the /delete parameter to remove the user from a group using command line in Windows 10.
The format of the command is as shown below.
net localgroup <groupname> <username> /delete
How to remove user from group using command line in Windows 10 ?
1. Open command prompt from the elevated administrator mode.
2. Enter the command. For example , if you want to remove the user abundantcodeuser from the Administrator group , you can do that using the below command
net localgroup administrators abundantcodeuser /delete
Note that when you try to run the command without the elevated mode , you will get the access denied error.
C:\Users>net localgroup administrators abundantcodeuser /delete System error 5 has occurred. Access is denied. C:\Users>