Manage Learn to apply best practices and optimize your operations.

Change user password with LS

To change the user password using Script, I wrote a simple exe file using the C API.

To change the user password using Script, I wrote a simple exe file using the C API. First compile the code bellow then you can use it from LS by executing it with the shell function.

You can send me a mail at and I'll send you the exe.

Put the following code in: ChangePassword.c

#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <malloc.h>
#include <errno.h>

#include <lapicinc.h>
#include <lapiplat.h>
#include <osenv.h>
#include <kfm.h>

char    OrigPassword[20];
char    NewPassword[20];
char    IDFileSpec[MAXENVVALUE+1];


  if (error)

if (argc<3)
	LAPI_RETURN ("Syntax ChangePassword.exe KeyFileName OrigPassword NewPassword");

if (argc==3)  
	strcpy(OrigPassword, argv[1]);
	strcpy(NewPassword, argv[2]);

/* Get the current user's id file path specification */
	if (error=!OSGetEnvironmentString ("KeyFileName", IDFileSpec, MAXENVVALUE))
		printf ("Cannot locate current id file, using NULL for pIDFilen");
		LAPI_RETURN (ERR(error));

	strcpy(IDFileSpec, argv[1]);
	strcpy(OrigPassword, argv[2]);
	strcpy(NewPassword, argv[3]);


if (error = SECKFMChangePassword (IDFileSpec, OrigPassword, NewPassword)) 
   LAPI_RETURN (ERR(error));


The Make file :

!include <ntwin32.mak>

# The name of the program.

PROGNAME = ChangePassword

# DEC Alpha doesn't want the structures to be packed so we use the CPU
# type to conditionally add it as part of compile string
!IF "$(CPU)" == "ALPHA"
cpuflags = 
cpuflags = /Zp

# Dependencies


# Compilation command.  

    $(cc) $(cdebug) $(cflags) $(cpuflags) /DNT $(cvars) $*.c

# Link command.
    $(link) $(linkdebug) $(conflags) -out:$@ $** notes0.obj $(conlibs) 
        notes.lib user32.lib
This was last published in October 2001

Dig Deeper on Lotus Notes Domino Administration Tools

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...


  • How do I size a UPS unit?

    Your data center UPS sizing needs are dependent on a variety of factors. Develop configurations and determine the estimated UPS ...

  • How to enhance FTP server security

    If you still use FTP servers in your organization, use IP address whitelists, login restrictions and data encryption -- and just ...

  • 3 ways to approach cloud bursting

    With different cloud bursting techniques and tools from Amazon, Zerto, VMware and Oracle, admins can bolster cloud connections ...