Password management using automation
Using the password management tool you can maintain passwords for IBM Datacap.
The password management DLL exports functions to maintain various passwords used by IBM Datacap.
The main goal of this DLL is Datacap developer can write automation tool for Datacap administrator for maintenance of various password used by Datacap.
- Take a back up of app file and Datacap registry before using this dll.
- This dll can be used only on existing Datacap installation; for any new installation the password should be set manually first.
- This dll saves encrypted password in app file and registry; the dll does not validate user id / password against active directory domain service or local account.
- User id must be identical in style. For example, if user id is user@domain.com then do not use domain\\user or vice-a-verse while using dll.
Prerequisites
You have admin/required rights to perform password change operation on services.
You are using user id and password for Datacap services and DB connection, and not using windows authentication/system authentication.
Features
- Manage password stored in app file.
- Manage password stored in registry for RuleRunner.
- Manage password for Datacap services.
- Manage app pool password for Datacap Services.
Target users
This dll can be used by Datacap developers who write an automation program for datacap administrators to manage password of various Datacap app files, services etc on various systems.
Dll exported function with examples
Programming language: C# 8.0 (VS 2019)
.Net framework: 4.7.2
platform: x86
1: Exported Class: CDatacapPasswordManager
Functions:
public int UpdateField(string appFilePath, string tag, string oldValue, string newValue)
Description: The above function will change parameters stored in App file.
The App file is an XML file containing Datacap passwords in encrypted format. The passwords stored are like Database connection string etc.
App file stores passwords / values provided by Datacap Application Manager.
For e.g. For sample TravelDocs application the app file is TravelDocs.app which is located at “{ installation path }\Datacap\TravelDocs” .
Parameters:
string appFilePath: Path to the app file of application.
(For example, if Datacap is installed on C drive the app file path for sample traveldoc application is “C:\Datacap\Traveldoc\Traveldoc.app”
string tag: xml tag of field in app file the password will be updated for this tag.
Possible values:
1: To change password in Database connection string use following tag.
(TAB 1 of Datacap Application Manager, please note all tags are in small case without any space)
tmadmin, tmengine, fingerprintconn, lookupdb, exportdb.
2: To change Custom values (TAB 3 of Datacap Application Manager)
2.1: For Generic String Values use gen/<parameter name>
(e.g if parameter name is GeneralStringValue1 the tag will be gen/GeneralStringValue1)
2.2: To change Data Source Connection String Values use
Dsn/<parameter name>
(e.g if parameter name is DataSourceConnectionStringValue1 the tag will be
dsn/DataSourceConnectionStringValue1)
2.3: To change Data Source Connection String Values In Datacap Format use tmdsn/<parameter name>
(e.g if parameter name is DataSourceConnectionStringValuesInDatacapFormat1the tag will be tmdsn/DataSourceConnectionStringValuesInDatacapFormat1)
2.4: To change Advanced Values use adv/<parameter name>
(e.g if parameter name is AdvancedValue1 tag will be adv/AdvancedValue1)
string oldValue: Old Password.
string newValue: New Password.
Return Value: Integer, 0 if function successful, -1 for error. (check log file for additional information)
Sample Code:
1: To change DB password for tmadmin.
Using SQLOLEDB (MSSQL)
static void Main(string[] args)
{
CDatacapPasswordManager con = new CDatacapPasswordManager();
Int result = con.UpdateField(
"C:\\Datacap\\TravelDocs\\TravelDocs.app", //Application Path
"tmadmin", // Tag value
"Provider=SQLOLEDB;Server=127.0.0.1;Database=TravelDoc;UID=user1;PWD=oldPassword;",
//Old connection String
"Provider=SQLOLEDB;Server=127.0.0.1;Database=TravelDoc;UID=user1;PWD=newPassword;");
//New connection String
if(-1 == result)
{
// Error, Check Log
}
}
- You must provide full connection string.
- The old password must match previously stored password.

2: To change Advanced Values
static void Main(string[] args)
{
CDatacapPasswordManager con = new CDatacapPasswordManager();
Int result = con.UpdateField(
"C:\\Datacap\\TravelDocs\\TravelDocs.app",
"adv/AdvancedValue1",
"oldValue",
"newValue");
if(-1 == result)
{
// Error, Check Log
}
}
The old value must match previously stored value.

2: Exported Class ChangeRegistryParam
Functions:
public int ChangeRuleRunnerRegistry(string oldUid, string oldPwd, string newUid, string newPwd, string machineName)
Description: The above function will change RulRunner password stored in Registry.
Parameters:
string oldUid: Old user id
string oldPwd: Old password
string newUid: New user id
string newPwd: New password
string machineName: machine name on which password need to reset.
(use machine name only, do not use IP. Use null value for local system.)
Return Value: Integer, 0 if function successful, -1 for error. (check log file for additional information)
static void Main(string[] args)
{
ChangeRegistryParam c = new ChangeRegistryParam();
Int result = c.ChangeRuleRunnerRegistry("olduser", "oldpassword", "newuser", "newpassword", "systemname");
if(-1 == result)
{
// Error, Check Log
}
}
The old value must match previously stored value.

3: Exported Class: ChangeServiceParam
Function:
public int ChangeServiceParameters(string serviceName, string serviceUserId, string servicePassword, string machineName))
Description: The above function will change password for Datacap Service TMS & RR.
Parameters:
string serviceName: name of service
for rule runner use “Datacap Rulerunner Service”
for Taskmaster use “DCTMS”
string serviceUserId: Local system user
string servicePassword: password to be set.
string machineName: machine name on which password need to reset.
(use machine name only, do not use IP. Use null value for local system.)
Return Value: Integer, 0 if function successful, -1 for error. (check log file for additional information)
Sample Code:
static void Main(string[] args)
{
ChangeServiceParam p = new ChangeServiceParam();
int result = p.ChangeServiceParameters("DCTMS", "user@domain.com", "password", "systmnname");
if(-1 == result)
{
// Error, Check Log
}
}

4: Exported Class: ChangeAppPoolPassword
Function:
public int ChangePoolPassword(string poolName, string olduserId, string oldPwd, string newPwd, string machineName)
Description: The above function will change password for Datacap Service application pool hosted in IIS.
Parameters:
string poolName: name of app pool
string olduserId: old user id
string oldPwd: old password
string newUserID: new user id
string newUPwd: new password
string machineName: machine name on which password need to reset.
(use machine name only, do not use IP. Use null value for local system.)
Return Value: Integer, 0 if function successful, -1 for error. (check log file for additional information)
Sample Code:
static void Main(string[] args)
{
ChangeAppPoolPassword p = new ChangeAppPoolPassword();
int result = p.ChangePoolPassword("AppPoolname", "olduser@domain.com", "oldpassword", "newuser@domain.com" "newpassword","systemname");
//return;
if(-1 == result)
{
// Error, Check Log
}
}
