Solved

VBScript get manager of an AD group

Posted on 2009-04-02
3
694 Views
Last Modified: 2012-05-06
Hi,
What is the easiest way to retrieve the manager of an AD group using VBScript. All I want to be displayed is the users Display name, not the fully qualified CN=...,OU=.... etc
Thanks :-)
0
Comment
Question by:churchlandsshs
  • 2
3 Comments
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 24055901
Hi there, you can retrieved the ManagedBy attribute this way.

Remember that when you specify the path to the group object, to put it in reverse order.

Regards,

Rob.
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
Set objGroup = GetObject("LDAP://CN=TestGroup1,OU=TestUsers,OU=TestOU," & strDNSDomain)
strManager = objGroup.Managedby
If strManager <> "" Then
	strManager = Mid(Split(strManager, ",")(0), 4)
	MsgBox strManager
Else
	MsgBox "There is no manager for " & Mid(objGroup.Name, 4)
End If

Open in new window

0
 

Author Closing Comment

by:churchlandsshs
ID: 31566064
Excellent as always
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 24055934
No problem. Thanks for the grade.

Regards,

Rob.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question