Re: Remove a Group

From: Mark-Allen Perry (mark-allen_at_mvps_dot_org)
Date: 09/22/04


Date: Wed, 22 Sep 2004 20:52:59 +0200

Check: http://www.15seconds.com/issue/011127.htm

I believe you'd use '.Remove'

Keep us informed on this, please. I'd like to know also.

-- 
And always try the MS KB first before posting.
The answer is probably already posted.
MS KB: http://support.microsoft.com/default.aspx?scid=fh;EN-US;KBHOWTO
----
Mark-Allen Perry
ALPHA Systems
Marly, Switzerland
mark-allen_AT_mvps_DOT_org
  "Keith" <@.> wrote in message news:ey1o$2KoEHA.592@TK2MSFTNGP11.phx.gbl...
  How can I remove a domain group from a local group?
  I have used the code below to add a specific domain group to the local admin 
  group on every machine the code is run on
  How can I now do the reverse and remove the group from any machine the code 
  is run on?
  '--------------------8<----------------------
  Set oWshNet = CreateObject("WScript.Network")
  sGroup = "Hanlon"
  sNetBIOSDomain = oWshNet.UserDomain
  sComputer = oWshNet.ComputerName
  Set oGroup = GetObject("WinNT://" & sComputer & "/Administrators,group")
  Set oUser = GetObject("WinNT://" & sNetBIOSDomain & "/" & sGroup & ",group")
  ' suppress errors in case the user is already a member
  On Error Resume Next
  oGroup.Add(oUser.ADsPath)
  On Error Goto 0
  '--------------------8<----------------------


Relevant Pages

  • Re: Group Policy questions
    ... supresses errors. ... > will not work as a logon script as when run twice, ... >> Purpose = add ITTechnicians Domain Group to Administrators Local Group ... >> 'Get domain group and assigned to ITTechs Variable ...
    (microsoft.public.windows.group_policy)
  • Re: Group Policy questions
    ... will not work as a logon script as when run twice, ... > Purpose = add ITTechnicians Domain Group to Administrators Local Group ... > 'Get domain group and assigned to ITTechs Variable ...
    (microsoft.public.windows.group_policy)
  • Re: How to configure local PC group membership via Group Policy?
    ... key the name of the Domain group you ... want to added to the local group. ... Don't put anything in the "Members of this group" box. ... > First is Add Group (I'm assuming I need to create a security group ...
    (microsoft.public.windows.group_policy)
  • Re: Adding Domain User to local PC
    ... ' Specify AdsPath of domain group to be added to ... ' Bind to domain group. ... ' Bind to local group. ...
    (microsoft.public.windows.server.scripting)