Go Back   TechArena Community > Technical Support > Computer Help > Windows Server > Windows Server Help
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: ,

Sponsored Links



Remove local user from local group

Windows Server Help


Reply
 
Thread Tools Search this Thread
  #1  
Old 07-10-2006
Maurice1972
 
Posts: n/a
Remove local user from local group

Because of new security guidelines we applying, we're trying to create a
script to remove the "Authenticated Users" account from the "Power Users"
group on the local machine. Unfortunately, I haven't been able to make it
work.

#### CODE BEGINS #####
Option Explicit
' Script to remove user from local group
' Removes Authenticated Users

DIM objGroup, objUser, strComputer, strGroup, strUser
strComputer = "." ' Local computer name'
strGroup="Power Users" ' Local group name'
strUser="Authenticated Users (S-1-5-11)" ' Local user name'

Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")
objGroup.Remove("WinNT://" & "NT Authority" & "/" & strUser)
#### CODE ENDS ####

Everytime we run it, it comes back with "Error: A member could not be added
to or removed from the local group because the member does not exist.
Code:8007056B"
I'm sure there's a simple answer, but I haven't been able to come up with it.

Any advice would be appreciated.

Thanks
Reply With Quote
  #2  
Old 07-10-2006
Jerold Schulman
 
Posts: n/a
Re: Remove local user from local group


If you use a .bat file:

net locaclgroup "Power Users" "Authenticated Users" /DELETE


On Fri, 6 Oct 2006 14:22:01 -0700, Maurice1972 <Maurice1972@discussions.microsoft.com> wrote:

>Because of new security guidelines we applying, we're trying to create a
>script to remove the "Authenticated Users" account from the "Power Users"
>group on the local machine. Unfortunately, I haven't been able to make it
>work.
>
>#### CODE BEGINS #####
>Option Explicit
>' Script to remove user from local group
>' Removes Authenticated Users
>
>DIM objGroup, objUser, strComputer, strGroup, strUser
>strComputer = "." ' Local computer name'
>strGroup="Power Users" ' Local group name'
>strUser="Authenticated Users (S-1-5-11)" ' Local user name'
>
>Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")
>objGroup.Remove("WinNT://" & "NT Authority" & "/" & strUser)
>#### CODE ENDS ####
>
>Everytime we run it, it comes back with "Error: A member could not be added
>to or removed from the local group because the member does not exist.
>Code:8007056B"
>I'm sure there's a simple answer, but I haven't been able to come up with it.
>
>Any advice would be appreciated.
>
>Thanks


Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com
Reply With Quote
  #3  
Old 12-10-2006
Maurice1972
 
Posts: n/a
Re: Remove local user from local group

That works perfectly. Just goes to show that Occam's Razor works. "The
simplest solution is usually the best".

Thanks Jerold

"Jerold Schulman" wrote:

>
> If you use a .bat file:
>
> net locaclgroup "Power Users" "Authenticated Users" /DELETE
>
>
> On Fri, 6 Oct 2006 14:22:01 -0700, Maurice1972 <Maurice1972@discussions.microsoft.com> wrote:
>
> >Because of new security guidelines we applying, we're trying to create a
> >script to remove the "Authenticated Users" account from the "Power Users"
> >group on the local machine. Unfortunately, I haven't been able to make it
> >work.
> >
> >#### CODE BEGINS #####
> >Option Explicit
> >' Script to remove user from local group
> >' Removes Authenticated Users
> >
> >DIM objGroup, objUser, strComputer, strGroup, strUser
> >strComputer = "." ' Local computer name'
> >strGroup="Power Users" ' Local group name'
> >strUser="Authenticated Users (S-1-5-11)" ' Local user name'
> >
> >Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")
> >objGroup.Remove("WinNT://" & "NT Authority" & "/" & strUser)
> >#### CODE ENDS ####
> >
> >Everytime we run it, it comes back with "Error: A member could not be added
> >to or removed from the local group because the member does not exist.
> >Code:8007056B"
> >I'm sure there's a simple answer, but I haven't been able to come up with it.
> >
> >Any advice would be appreciated.
> >
> >Thanks

>
> Jerold Schulman
> Windows Server MVP
> JSI, Inc.
> http://www.jsiinc.com
> http://www.jsifaq.com
>

Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Windows Server > Windows Server Help


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Remove local user from local group"
Thread Thread Starter Forum Replies Last Post
ad user to Local group aconti Active Directory 1 21-05-2011 06:25 AM
Add domain user\group to local admin group problem DangerMaus Active Directory 12 16-10-2009 10:30 PM
Remove user account from local administrators group via GPO fshguo Active Directory 3 24-02-2009 06:54 PM
Adding group/user to local Admins group on all workstations? Barkley Bees Window 2000 Help 5 04-07-2008 07:10 AM
Problem adding local user to local group or deleting local user fkitzmann Window 2000 Help 4 16-02-2008 08:32 AM


All times are GMT +5.5. The time now is 06:54 PM.