//**后台CS代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.DirectoryServices;
namespace TestAlertWindowUserPassword
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
DirectoryEntry AD = new DirectoryEntry("WinNT://192.168.1.123", "administrator", "ABCabc123");
DirectoryEntry de = AD.Children.Find("ritacc", "user");
try
{
de.Invoke("setPassword", new object[] { "BCabcA123" });
de.CommitChanges();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
de.Close();
de.Dispose();
AD.Close();
AD.Dispose();
}
// AD.Children.
}
}
}