Tip

Verify Group Members In Nab

Have you ever looked at the list of names in a group in your addressbook and
thought, "he retired last year"? This script verifies the membership in groups
in the name and addressbook. It generates a simple report showing exceptions.
Put this script in an agent and schedule it or run it manually on command. If
it is scheduled, the report will be saved on the server.

Current limitations:
- Server names and wildcards are reported as exceptions.
- Agent must reside in the NAB.
Sub Initialize

Dim Session As New NotesSession
Dim DB As NotesDatabase
Dim Group As NotesDocument
Dim Person As NotesDocument
Dim ReadPG As NotesDocument
Dim GView As NotesView
Dim PGView As NotesView

Dim fileNum As Integer
FileNum% = Freefile()
Close
Print "Logging output messages to \APPS\NOTES\GROUP.LOG"
Open "group.log" For Output As fileNum%
Print #FileNum%, "Audit Group Agent ", Now ' print a header line to log file
Print "Audit Group Agent ", Now ' print to log db (or to status line if run
manually)

Set DB = Session.CurrentDatabase
Set GView = DB.GetView ( "($VIMGroups)" )
Set PGView = DB.GetView ( "($VIMPeopleandGroups)" )

Set Group = GView.GetFirstDocument

Do Until Group Is Nothing
Print #FileNum%, Chr(10) & "Group: " & Group.ListName(0) & " " &
Group.ListDescription(0) & " - - - - - -"

Forall i In Group.Members
Set PersonName = New NotesName( i )
Set ReadPG = PGView.GetDocumentByKey( PersonName.Abbreviated )
If ReadPG Is Nothing Then
Print #FileNum%, " Entry does NOT exist - - " & PersonName.Abbreviated
Else
Print #FileNum%, " " & PersonName.Abbreviated
End If
End Forall ' all members

Set Group = GView.GetNextDocument ( Group )
Loop ' all groups

Close

End Sub

This was first published in November 2000

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.