Blog

Our News/Articles/Opinions/Technotes from the world of HCL Digital Solutions

How to update multiple passwords in ID vault programmatically

HCL recently published a technote on how to reset multiple passwords at the same time.

It’s a handy bit of code to have for reference.

Couple of obvious points to make.

  1. This doesn’t bypass any security, you’re still going to need to run this agent as an ID that has password reset authority access.
  2. Don’t reset passwords to be the same as each other as in the code (unless there is a compelling reason to do so) – add in logic to generate differing passwords.

Steps code referenced is below (test, do at your own risk, etc).

Open Names.nsf
Create –> Agent –> LotusScript Agent – Name it as ‘Reset Password’
Click on ‘Initialize’
Paste the below code between ‘Sub Initialize’ and ‘End Sub’

Dim s As New NotesSession
Dim vault As NotesIDVault
Set vault = s.GetIDVault()
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim username As String
Dim collection As NotesDocumentCollection

Dim newPassword As String ‘ Define the new password or generate it securely

Set db = s.CurrentDatabase
Set collection=db.Unprocesseddocuments
‘Set view = db.GetView(“$Users”)
Set doc = collection.GetFirstDocument

Do Until doc Is Nothing
username = doc.GetItemValue(“FullName”)(0) ‘ Assuming FullName field contains canonical username
newPassword = “password123” ‘ Replace with your desired password generation logic
‘MessageBox username
‘ Call ResetUserPassword

Call vault.ResetUserPassword(username, newPassword, “Servername/HCL”, 0) ‘ 0 for no download count limit. Change the server name

Set doc = collection.GetNextDocument(doc)
Loop

MessageBox “Reset completed”

Cormac McCarthy – Domino People Ltd

This image has an empty alt attribute; its file name is image.png

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>