Cleanup your Domino Directory Group structure
When you run a large Domino Installation with a high fluctuation of people coming in and out, you might end up with a lot of Zombies in your groups. This might happen especially with part time administrators, who are to busy with their main jobs (and don't use AdminP to delete users). I had to do a clean-up exercise recently and I used the simplicity of @Formulas to remove user names that are no longer in the Domino Directory from all group entries where they might still be in:
Step 1: Create a new view named (GroupCleanup)|GroupCleanup with one column. Sort that column.
View selection formula: SELECT ( Type= "Person":"Group":"Server" )
Column formula: @If(Type = "Person"; @Subset(Fullname; 1);Type = "Server"; @Subset(Servername; 1); @Subset(ListName; 1))
Step 2:Create an agent, type formula to run against selected documents:
SELECT @All;
v := "GroupCleanup";
c := @Elements(Members);
good := "";
found := "";
@For(i:=1;i<c+1;i:=i+1;
current := Members[i];
found := @Trim(@DbLookup("Notes":"NoCache";"";v;current;1;[FailSilent]));
@If(@Contains(current;"*");good :=good:current;good :=good:found));
finalgood := @Trim(@Unique(good));
finalbad :=@Trim(@Replace(Members;finalgood;""));
FIELD removedMembers := @Trim(@Unique(removedMembers:finalbad));
FIELD Members := finalgood;
Step 3: Use an agent to remove groups that don't have members anymore. Run the agents multiple times to get rid of nested redundant groups:
SELECT type="Group" & @Trim(members)="";
@DeleteDocument;
Caveat: This will remove all user names that are not in the main addressbook. That means all users of external organizations might get lost too. You could extend the formula by adding more @dblookups to additional addressbooks.
Step 1: Create a new view named (GroupCleanup)|GroupCleanup with one column. Sort that column.
View selection formula: SELECT ( Type= "Person":"Group":"Server" )
Column formula: @If(Type = "Person"; @Subset(Fullname; 1);Type = "Server"; @Subset(Servername; 1); @Subset(ListName; 1))
Step 2:Create an agent, type formula to run against selected documents:
SELECT @All;
v := "GroupCleanup";
c := @Elements(Members);
good := "";
found := "";
@For(i:=1;i<c+1;i:=i+1;
current := Members[i];
found := @Trim(@DbLookup("Notes":"NoCache";"";v;current;1;[FailSilent]));
@If(@Contains(current;"*");good :=good:current;good :=good:found));
finalgood := @Trim(@Unique(good));
finalbad :=@Trim(@Replace(Members;finalgood;""));
FIELD removedMembers := @Trim(@Unique(removedMembers:finalbad));
FIELD Members := finalgood;
Step 3: Use an agent to remove groups that don't have members anymore. Run the agents multiple times to get rid of nested redundant groups:
SELECT type="Group" & @Trim(members)="";
@DeleteDocument;
Caveat: This will remove all user names that are not in the main addressbook. That means all users of external organizations might get lost too. You could extend the formula by adding more @dblookups to additional addressbooks.
Posted by Stephan H Wissel on 17 May 2004 | Comments (6) | categories: IBM Notes Lotus Notes