VBScript to interrogate Domino Lotus Notes Servers
- From: meridean <chris.john.flynn@xxxxxxxxx>
- Date: Thu, 12 Jul 2007 02:17:42 -0700
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
.
- Prev by Date: Re: Renaming AD User Accounts using the WinNT Provider
- Next by Date: Re: sending email from within a script
- Previous by thread: sending email from within a script
- Next by thread: SIDHistory - variant or Byte()??
- Index(es):
Relevant Pages
|