Password Sync Extension
Hi there we made a project for password sync extension and we implement all the method for the IMApasswordManagement, I we create a text file after each method. We did succes on the next methods: --Beginconnectiontoserver and Endconnectiontoserver. But we can start the ChangePassword Method. this is our code: ----------------------------------------------------------------------------------------------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.MetadirectoryServices; using System.Data.Odbc; using System.Data; using System.IO; namespace PwdSync { public class PwdSync : IMAPasswordManagement { #region IMAPasswordManagement Members public void BeginConnectionToServer(string connectTo, string user, string password) { StreamWriter file = new StreamWriter(@"c:\Begin.txt"); file.WriteLine("Start conection"); file.Close(); } public void ChangePassword(CSEntry csentry, string OldPassword, string NewPassword){ StreamWriter file = new StreamWriter(@"c:\Change.txt"); file.WriteLine("yes Change"); file.Close(); OdbcConnection conn = new OdbcConnection(); DataSet ds = new DataSet(); conn.ConnectionString = "Dsn=------------;" + "Host= ---------------;" + "Server=------------ ;" + "Service=-------------;" + "Protocol=--------------;" + "Database=---------------;" + "Uid=---------------;" + "Pwd=---------------;"; conn.Open(); string select = "update schema.myvista set password='" + NewPassword.ToString() +"' where id ='" + csentry["id"].Value.ToString() + "'"; OdbcCommand cmd = new OdbcCommand(select, conn); cmd.ExecuteNonQuery(); conn.Close(); } public void EndConnectionToServer() { StreamWriter file = new StreamWriter(@"c:\EndConn.txt"); file.WriteLine("End connection"); file.Close(); } public ConnectionSecurityLevel GetConnectionSecurityLevel() { return ConnectionSecurityLevel.NotSecure; } public void RequireChangePasswordOnNextLogin(CSEntry csentry, bool fRequireChangePasswordOnNextLogin) { throw new NotImplementedException(); } public void SetPassword(CSEntry csentry, string NewPassword) { throw new NotImplementedException(); } #endregion } } ---------------------------------------------------------------------------------------------------------------------------------------------------------------- somebody can give us some guidance this of the password sync is new for us. cheers everyone
July 22nd, 2010 8:44pm

A good place to start is here: Using Password Extensions I normally use PowerShell to test it. Look for the script at the bottom of this page: Example: Setting Passwords Some things about your code: take advantage of BeginConnection and EndConnection to open/close your SQL connections it appears your code doesn't use credentials, so it depends on the service account credentials - not a great idea but it might work catch some exceptions, otherwise you're going to lose password changes CraigMartin Edgile, Inc. http://identitytrench.com
Free Windows Admin Tool Kit Click here and download it now
July 22nd, 2010 11:23pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics