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
bi...@2burkes.com
Cheers
"Bill Burke" <Bill_...@newsguy.com> wrote in message
news:bsq03...@drn.newsguy.com...
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:%23mkyjxm...@TK2MSFTNGP12.phx.gbl...
Thank you for your help... I'll have to test it next week - have another
scripting issue to resolve.....
Thanks,
Bill Burke
In article <u4EbY9nz...@TK2MSFTNGP10.phx.gbl>, Richard Mueller [MVP]"
<rlmuelle...@ameritech.NOSPAM.net> says...