> Ken wrote:
>
> >I need to remove all membership in the local power users group on the local
> > machines. I would like to use a logon scipt to do this. I see examples
> > of
> > adding or removing specific users but nothing to set group membership to
> > 0.
>
> First, this won't work in a logon script, unless the user is a member of the
> local Administrators group. It could be done in a Startup script, which runs
> with System privileges on the local machine. Even better, a member of Domain
> Admins should be able to do this remotely if the computer is authenticated
> to the domain. By default, the group Domain Admins is added to the local
> Administrators group when the computer is joined to the domain.
>
> In either case (a startup script or a script run remotely), I don't know of
> any method to remove all members of a group at once. You must enumerate each
> member and remove individually. You must use the WinNT provider to deal with
> local objects. A VBScript example:
> =========
> ' Specify the NetBIOS name of the computer.
> ' You can use "." for current local computer.
> strComputer = "TestComputer"
>
> ' Bind to local Power Users group on the computer.
> Set objLocalGroup = GetObject("WinNT://" & strComputer & "/Power
> Users,group")
>
> ' Enumerate all members of the local group.
> For Each objMember In objLocalGroup.Members
> ' Remove the member from the group.
> objLocalGroup.Remove(objMember.AdsPath)
> Next
> ========
> You can test by first having the loop enumerate the members (Wscript.Echo
> objMember.Name), then revise to remove.
>
> --
> Richard Mueller
> Microsoft MVP Scripting and ADSI
> Hilltop Lab -
http://www.rlmueller.net> --
>
>
>