Hello,

I need to be able to remove users from the LOCAL Administrators group. I have
found samples of removing users from domain groups - I have to be able to remove
users from the LOCAL Administrators group.

All suggestions are greatfully accepted.

TIA,
Bill Burke
bill@2burkes.com

Re: Remove user from LOCAL group by 1

1
Mon Dec 29 18:32:30 CST 2003

Depending on the method used in the samples you have read you might find
that using the local machines NetBIOS name as the domain name will work.
This will work with, say, ADSI....

Cheers


"Bill Burke" <Bill_member@newsguy.com> wrote in message
news:bsq03h014dc@drn.newsguy.com...
> Hello,
>
> I need to be able to remove users from the LOCAL Administrators group. I
have
> found samples of removing users from domain groups - I have to be able to
remove
> users from the LOCAL Administrators group.
>
> All suggestions are greatfully accepted.
>
> TIA,
> Bill Burke
> bill@2burkes.com
>



Re: Remove user from LOCAL group by Richard

Richard
Mon Dec 29 20:45:54 CST 2003

Hi,

The procedure is to bind to the local group with the WinNT provider and
invoke the Remove method of the group object. You pass the AdsPath of the
member to be removed to the Remove method. I like to bind to the member to
be removed, so if there is an error I can tell if it is because I failed to
identify the user. This will work whether the user is a local user on the
machine, or a domain user. It also works if the member is a group. The
example below removes two members of the local Administrators group. One
member is a local user and the other a domain user:

strComputer = "MyComputer"
strDomain = "MyDomain"
strLocalUser = "TestUser"
strDomainUser = "JoeSmith"

Set objGroup = GetObject("WinNT://" & strComputer & "/administrators,group")
Set objLocalMember = GetObject("WinNT://" & strComputer" & "/" &
strLocalMember & ",user")
Set objDomainMember = GetObject("WinNT://" & strDomain & "/" & strDomainUser
& ",user")
objGroup.Remove(objLocalMember.AdsPath)
objGroup.Remove(objDomainMember.AdsPath)

--
Richard
Microsoft MVP Scripting and ADSI
HilltopLab web site - http://www.rlmueller.net
--

"1" <1@2.3> wrote in message news:%23mkyjxmzDHA.2456@TK2MSFTNGP12.phx.gbl...
> Depending on the method used in the samples you have read you might find
> that using the local machines NetBIOS name as the domain name will work.
> This will work with, say, ADSI....
>
> Cheers
>
>
> "Bill Burke" <Bill_member@newsguy.com> wrote in message
> news:bsq03h014dc@drn.newsguy.com...
> > Hello,
> >
> > I need to be able to remove users from the LOCAL Administrators group.
I
> have
> > found samples of removing users from domain groups - I have to be able
to
> remove
> > users from the LOCAL Administrators group.
> >
> > All suggestions are greatfully accepted.
> >
> > TIA,
> > Bill Burke
> > bill@2burkes.com
> >
>
>



Re: Remove user from LOCAL group by Bill

Bill
Tue Dec 30 11:07:06 CST 2003

Richard,

Thank you for your help... I'll have to test it next week - have another
scripting issue to resolve.....

Thanks,
Bill Burke

In article <u4EbY9nzDHA.2412@TK2MSFTNGP10.phx.gbl>, Richard Mueller [MVP]"
<rlmueller-NOSPAM@ameritech.NOSPAM.net> says...
>
>Hi,
>
>The procedure is to bind to the local group with the WinNT provider and
>invoke the Remove method of the group object. You pass the AdsPath of the
>member to be removed to the Remove method. I like to bind to the member to
>be removed, so if there is an error I can tell if it is because I failed to
>identify the user. This will work whether the user is a local user on the
>machine, or a domain user. It also works if the member is a group. The
>example below removes two members of the local Administrators group. One
>member is a local user and the other a domain user:
>
>strComputer = "MyComputer"
>strDomain = "MyDomain"
>strLocalUser = "TestUser"
>strDomainUser = "JoeSmith"
>
>Set objGroup = GetObject("WinNT://" & strComputer & "/administrators,group")
>Set objLocalMember = GetObject("WinNT://" & strComputer" & "/" &
>strLocalMember & ",user")
>Set objDomainMember = GetObject("WinNT://" & strDomain & "/" & strDomainUser
>& ",user")
>objGroup.Remove(objLocalMember.AdsPath)
>objGroup.Remove(objDomainMember.AdsPath)
>
>--
>Richard
>Microsoft MVP Scripting and ADSI
>HilltopLab web site - http://www.rlmueller.net
>--
>
>"1" <1@2.3> wrote in message news:%23mkyjxmzDHA.2456@TK2MSFTNGP12.phx.gbl...
>> Depending on the method used in the samples you have read you might find
>> that using the local machines NetBIOS name as the domain name will work.
>> This will work with, say, ADSI....
>>
>> Cheers
>>
>>
>> "Bill Burke" <Bill_member@newsguy.com> wrote in message
>> news:bsq03h014dc@drn.newsguy.com...
>> > Hello,
>> >
>> > I need to be able to remove users from the LOCAL Administrators group.
>I
>> have
>> > found samples of removing users from domain groups - I have to be able
>to
>> remove
>> > users from the LOCAL Administrators group.
>> >
>> > All suggestions are greatfully accepted.
>> >
>> > TIA,
>> > Bill Burke
>> > bill@2burkes.com
>> >
>>
>>
>
>