Jump to content

Remove group from local administratorsgroup


Recommended Posts

I want to remove a group from the local administrators group. The problem I have is that the command line "net local group groupname /delete" doesn't work if there are more than about 20 characters in the groupname eg.

"net local group testgroup /delete" will delete the group

"net local group This-Is-A-Test-group-with-many-characters /delete" will NOT remove the group

Is there anything within AutoIt that could do this, I cant find anything.

Thanks for looking

[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

Link to comment
Share on other sites

try this:

"net local group 'This-Is-A-Test-group-with-many-characters' /delete"

Or try with WMI:

Global $oLocalGroup = ObjGet("WinNT://" & @ComputerName & "/Power Users")

$oLocalGroup.Add("WinNT://" & $sDomainName & "/" & $sGlobalGroup)
If $f_COMError Then
    MsgBox(16, "Error", "Rats!")
Else
    MsgBox(64, "Success", "Woohoo!")
EndIf
Link to comment
Share on other sites

Sorry... bad description. Post should read

"net local group Administratots testuser /delete" will delete the group

"net local group Administrators This-Is-A-Test-user-with-many-characters /delete" will NOT remove the group

Juvigy -Thanks for this. I tried the "net local group 'This-Is-A-Test-group-with-many-characters' /delete" option before posting and it also doesn't work. It's a real pain and must be a bug as I can see no reason why there would be a character limit.

[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...