VBScript to interrogate Domino Lotus Notes Servers

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi All,

I recently required code to script the creation, deletion and removal
of Person Record for Lotus Notes and really struggled to find some
code for this. I therefore wanted to post my working code online in
case it could help others. The following conditions are required for
the code to work:

A) Variables are inputted from other areas of my Script therefore you
will need to modify the code to change this info.
B) Lotus Notus Administrator Version 7 is required and needs to be
open before exectuing this code.

Here are my Subs:

'==================================================================================
'***This Sub registers the user in LN and creates the ID file and then
sets the users password.***
'==================================================================================
Sub LNaccount
(firstname,middlename,lastname,username,template,strusername,strNTServer,strMail,strID,sLNpassword,_
strMailLocation,strmailtemplate)

Const ACLLEVEL_EDITOR = 4
Const ACLLEVEL_MANAGER = 7
Const REG_MAIL_OWNER_ACL_EDITOR = 2
Const REG_MAIL_OWNER_ACL_MANAGER = 0
Const NOTES_FULL_CLIENT = 176
Const ID_HIERARCHICAL = 172
stradmins = "NOTES MANAGERS"

Set ObjSess = CreateObject("Lotus.NotesSession")
ObjSess.Initialize sLNpassword
Set reg = ObjSess.CreateRegistration
If middlename = "" Then
reg.MailInternetAddress = firstname & "_" & lastname &
"@Company.co.uk"
Else
reg.MailInternetAddress = firstname & "_" & middlename & "_" &
lastname_ & "@Company.co.uk"
End If
intExpiry = DateDiff("d", NOW, "01/01/2099")
reg.Expiration = NOW + intExpiry
reg.RegistrationServer = "Domino Admin Server Name(Fully Qualified)"
reg.CertifierIDFile = "\\Servername\Certids\" & strID
reg.CreateMailDB = True
reg.IDType = ID_HIERARCHICAL
reg.IsNorthAmerican = False
reg.MinPasswordLength = 6
reg.UpdateAddressbook = True
reg.StoreIDInAddressbook = False
reg.ShortName = username
reg.MailOwnerAccess = REG_MAIL_OWNER_ACL_MANAGER
reg.Mailaclmanager = stradmins
reg.MailTemplateName = strmailtemplate
reg.RegisterNewUser lastname,"\\Servername\Userids\" & strusername
& ".id", strMail,_ firstname, middlename, systemadmin, "", "",
strMailLocation & "\" & strusername & ".nsf", "", strusername_ & "01",
NOTES_FULL_CLIENT
msgbox "Lotusnotes and Intranet Password: " & strusername & "0101" &
VBCRLF & "Please make a _ note of these details."
MsgBox "The User has now been created"

End sub
'==================================================================================
'Sub to Delete the Leavers Lotus Notes Address Book Entries
'==================================================================================
Sub RemoveLNRecord(strLnusername, sLNpassword)

Const ID_HIERARCHICAL = 172
Const MAILFILE_DELETE_NONE = 0
Const MAILFILE_DELETE_ALL = 2
Const Immediate = True'======Enter True or False. True deletes all
references to the user in the_ Domino Directory before issuing an
administration process request. False lets the administration process
make_ all deletions.

Set ObjSess = CreateObject("Lotus.NotesSession")
ObjSess.Initialize sLNpassword
Set adminp = notesSession.CreateAdministrationProcess("Fully
Qualified Domino Server_ Name")
Call adminp.DeleteUser(strLnusername , Immediate ,_
MAILFILE_DELETE_NONE, "", False)
Set ObjSess = nothing
MsgBox strLnusername & " has now had his person records removed."

End Sub
'==================================================================================
'Sub to Delete the Leavers Lotus Notes User Accounts Including replica
ID files
'==================================================================================
Sub DeleteLNUser(strLnusername, sLNpassword, strLnServer)

Const ID_HIERARCHICAL = 172
Const MAILFILE_DELETE_NONE = 0
Const MAILFILE_DELETE_ALL = 2
Const Immediate = False '=====Enter True or False. True deletes all
references to the user in the_ Domino Directory before issuing an
administration process request. False lets the administration process
make_ all deletions.

Set ObjSess = CreateObject("Lotus.NotesSession")
ObjSess.Initialize sLNpassword
Set adminp = ObjSess.CreateAdministrationProcess(strLnServer)
Call adminp.DeleteUser(strLnusername , Immediate ,_
MAILFILE_DELETE_ALL, "", False)
Set ObjSess = nothing
MsgBox strLnusername & " has been deleted."

End sub


Hope this code helps some of you out there.
Thanks

.



Relevant Pages

  • VBScript to Remove Lotus Notes Person Record
    ... Record in lotus notes but a struggling to find the code to do this. ... 'Sub to Delete the Leavers Lotus Notes Address Book Entries ... issuing an administration process request. ... Set ObjSess = CreateObject ...
    (microsoft.public.scripting.vbscript)
  • Re: How can I make my Excel invoice template work with Office 2007?
    ... Const NumberingFilename = "Invoice" ... Dim wbDataTable As Workbook ... If Not Then Exit Sub ... On Error GoTo 0 ...
    (microsoft.public.excel.misc)
  • Script not Functioning Properly
    ... the script is supposed to automatically reply to any new ... Const CdoPR_ACTION_FLAG = &H10810003 ... Public Sub Folder_OnMessageCreated ...
    (microsoft.public.outlook.program_vba)
  • RE: Inter Macro
    ... Const Questions = 50. ... Sub TestUniqueRandomNumbers() ... Case 0: NumberofTests = 12 ... NewUser = True ...
    (microsoft.public.excel.programming)
  • Quick Date entry revisited
    ... change the Compiler constand #Const US_STYLE ... Private Sub Worksheet_SelectionChange ... 'value has been changed to text format ... 'This is the European and US date entry / format version ...
    (microsoft.public.excel.programming)