Add and remove AD user to and from local group 
Author Message
 Add and remove AD user to and from local group

I can't get this to workstrComputer = "MyComputer"
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group")
set oUser = GetObject(LDAP://CN=UserToAdd,CN=Users,DC=MyDom,DC=dk)
objGroup.Add(objUser.ADsPath) 'I get an error here


Tue, 19 Jul 2005 02:48:40 GMT  
 Add and remove AD user to and from local group
Sorry a misspell it is:

strComputer = "MyComputer"

Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group")

set oUser = GetObject(LDAP://CN=UserToAdd,OU=Users,DC=MyDom,DC=dk)

objGroup.Add(oUser.ADsPath)

'But it still don't work



Tue, 19 Jul 2005 03:11:04 GMT  
 Add and remove AD user to and from local group

Multipost; response in microsoft.public.adsi.general

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and a ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter



Wed, 20 Jul 2005 07:27:09 GMT  
 Add and remove AD user to and from local group
Yeah - I thought maybe that was the right place. Did not know its existance.
The answer was that I was mixing providers.
So I think it should be

objGroup.Add("WinNT://" & NetBiosDomain & "\" & NTname)

instead


Quote:
> I can't get this to workstrComputer = "MyComputer"
> Set objGroup = GetObject("WinNT://" & strComputer &

"/Administrators,group")
Quote:
> set oUser = GetObject(LDAP://CN=UserToAdd,CN=Users,DC=MyDom,DC=dk)
> objGroup.Add(objUser.ADsPath) 'I get an error here



Wed, 20 Jul 2005 10:57:40 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Add a AD user to local group using directoryentry

2. VB script: adding AD group to local administrators group

3. Adding multiple users or groups to local groups

4. Find user in AD and add them to group

5. Adding Users a group in AD

6. Find user in AD and add them to group

7. Add user to group in AD

8. add user to local win2k administrator group

9. Add user to local W2kAS admin group?

10. Add USERS local group to drive c:\ with all permissions

11. Add and remove existing users to-from existing groups

12. Adding non-admin users to local admin group

 

 
Powered by phpBB® Forum Software