Sign in to follow this  
Followers 0
shornw

Remove group from local administratorsgroup

4 posts in this topic

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]

Share this post


Link to post
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

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites

Actually there is a character limit.

Did you try the WMI solution? Just change ADD with Remove

Share this post


Link to post
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
Sign in to follow this  
Followers 0