Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 737
  • Last Modified:

VBScript get manager of an AD group

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
churchlandsshs
Asked:
churchlandsshs
  • 2
1 Solution
 
RobSampsonCommented:
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
 
churchlandsshsAuthor Commented:
Excellent as always
0
 
RobSampsonCommented:
No problem. Thanks for the grade.

Regards,

Rob.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now