× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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();

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.