Advertisement

10.19.2007 at 01:44PM PDT, ID: 22905649
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

Enumerating members of Active Directory Groups

Asked by Erdrick33 in VB Script, Exchange Email Server, Windows 2003 Server

Tags: , ,

The below script works fine, but I am looking to query the manager of each account queried.  Our AD does hold the manager data in the organization tab, I just don't know the name of the object.  A little help would be appreciated.  Also, I realize my code is sloppy near the end, some pointers on the if then nesting would be nice too, as I couldn't get the if (instr... & instr...) then to work.

Note.  the -vm is so that I don't list voicemail email accounts.

Const EXCHANGE_SERVER_NAME = "ABCXCHSVR"
Const VM = "-VM"
Const ADS_SCOPE_SUBTREE = 2

Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"

Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection

Set objRootDSE = GetObject("LDAP://RootDSE")
objCommand.CommandText = "SELECT sAMAccountName, msExchHomeServerName, homeMDB, " &_
      "department FROM 'LDAP://" & objRootDSE.Get("defaultNamingContext") &_
      "' WHERE objectClass='user' AND objectCategory='person'"
Set objRootDSE = Nothing

objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 600
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Cache Results") = False

Set objRecordSet = objCommand.Execute

Set objFileSystem = CreateObject("Scripting.FileSystemObject")
Set objFile = objFileSystem.OpenTextFile("Users.txt", 2, True, 0)

While Not objRecordSet.EOF
      strServer = "" : strServer = objRecordSet.Fields("msExchHomeServerName")

      If InStr(1, strServer, EXCHANGE_SERVER_NAME, VbTextCompare) > 0 Then
            strUsername = "" : strStore = "" : strDepartment = ""
            strUsername = objRecordSet.Fields("sAMAccountName")
            strStore = objRecordSet.Fields("homeMDB")
            strDepartment = objRecordSet.Fields("department")

            If instr(strServer, 2) = 0 Then
                  If instr(strServer, 3) = 0 &
                        If instr(1, strUsername, VM, VbTextCompare) = 0 Then
                              objFile.WriteLine strUsername & VbTab & strDepartment
                        End If
                  End If
            End If
            
      End If

      objRecordSet.MoveNext
WEnd

Set objFile = Nothing
Set objFileSystem = Nothing
Set objRecordSet = Nothing
Set objCommand = Nothing
Set objConnection = NothingStart Free Trial
[+][-]10.19.2007 at 01:53PM PDT, ID: 20112314

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.19.2007 at 02:07PM PDT, ID: 20112410

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.19.2007 at 06:22PM PDT, ID: 20113419

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.19.2007 at 07:53PM PDT, ID: 20113561

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.20.2007 at 01:23AM PDT, ID: 20114136

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.22.2007 at 07:24AM PDT, ID: 20123357

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.22.2007 at 07:31AM PDT, ID: 20123423

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: VB Script, Exchange Email Server, Windows 2003 Server
Tags: active, directory, enumerate
Sign Up Now!
Solution Provided By: Chris-Dent
Participating Experts: 4
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628