The procedure deletes the given user from the given local group. The user can be a Domain User or Local User so please be aware of the user you are going to delete. We can use the script in deleting unused users from the Windows Endpoint - Such that one of the cases is deleting expired or inactive domain users.
Please Run the script as System User
The script needs to add double quotation mark when group or user name has space between them.
like gname=' "Power Users" '
gName = 'local group name' and uName = 'local or domain user'