VBScript get manager of an AD group

Posted on 2009-04-02
Medium Priority
Last Modified: 2012-05-06
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 :-)
Question by:churchlandsshs
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 65

Accepted Solution

RobSampson earned 2000 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.


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
	MsgBox "There is no manager for " & Mid(objGroup.Name, 4)
End If

Open in new window


Author Closing Comment

ID: 31566064
Excellent as always
LVL 65

Expert Comment

ID: 24055934
No problem. Thanks for the grade.



Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
This script will sweep a range of IP addresses (class c only, and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

770 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