Re: Add domain group to local group?
From: Steve Thompson (stevethompson_at_nomail.please)
Date: 11/10/04
- Next message: Jack: "Script not working as it should"
- Previous message: Bob Barrows [MVP]: "Re: Scheduler "Path not found" err - More info"
- In reply to: Steve Thompson: "Add domain group to local group?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 10 Nov 2004 10:02:16 -0500
"Steve Thompson" <stevethompson@nomail.please> wrote in message
news:u$qasNzxEHA.2984@TK2MSFTNGP10.phx.gbl...
> I'm looking for a code snippet to add a domain global group to a local
group
> (such as Administrators) on a client.
Found the answer after posting this question, code from Richard Mueller
(thanks Richard).
' Specify AdsPath of domain group to be added to
' local Administrators group.
' strDomainGroup = "WinNT://MyDomain/ComputerAdmins,group"
' Bind to domain group.
Set objDomainGroup = GetObject(strDomainGroup)
' Retrieve local computer NetBIOS name.
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
' Bind to local Administrators group.
Set objLocalGroup = GetObject("WinNT://" & strComputer _
& "/Administrators,group")
' Check if domain group already a member.
If Not objLocalGroup.IsMember(objDomainGroup.AdsPath) Then
' Add domain group to local group.
objLocalGroup.Add(objDomainGroup.AdsPath)
End If
- Next message: Jack: "Script not working as it should"
- Previous message: Bob Barrows [MVP]: "Re: Scheduler "Path not found" err - More info"
- In reply to: Steve Thompson: "Add domain group to local group?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|