|
I have a java program that runs on the System I that updates various Active Directory Attributes with values found in our HR system.
I have been asked to do an update to the TerminalServicesProfilePath attribute, but my regular methods do not seem to be able to update or retrieve the value of this attribute.
Has anyone done this, and could you provide me a sample of how I can get this attr updated from within my Java Program? I have googled and searched, but cannot find a Java solution.
I am providing a sample of my program on how I currently update other values. I have only supplied a sample of 2 mods to reduce the source side. This Java program is called from a CLP file read loop and is executed for each active employee.
String strDN = args[0];
String parm01 = args[1];
String parm02 = args[2];
env.put(
Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
//set security credentials, note using simple cleartext authentication
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, adminName);
env.put(Context.SECURITY_CREDENTIALS, adminPassword);
//connect to my domain controller
env.put(Context.PROVIDER_URL, "ldap://boedc001.kcmsd.int:389");
try
{
// Create the initial directory context
LdapContext ctx = new InitialLdapContext(env, null);
// Set Attribute values
ModificationItem[] mods = new ModificationItem[23];
mods[0] =
new ModificationItem(
DirContext.REPLACE_ATTRIBUTE,
new BasicAttribute("department", parm01.trim() + " "));
mods[1] =
new ModificationItem(
DirContext.REPLACE_ATTRIBUTE,
new BasicAttribute(
"departmentNumber",
parm02.trim() + " "));
userName = strDN;
// Perform the update
ctx.modifyAttributes(userName, mods);
//tls.close();
ctx.close();
--
This is the Java Programming on and around the IBM i (JAVA400-L) mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.