C#修改window本地帐号密码
2010-07-16 14:27
513 查看
//**后台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.
}
}
}
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.
}
}
}
相关文章推荐
- 一种简单的修改所有域内本地管理员密码,及加某个帐号至本地管理员组的方法
- 创建本地用户、修改用户密码及将用户添加到用户组的代码(C#)
- 如何在安装了symantec backup exec 2012的系统中修改本地或域帐号的密码
- C# 建立AD帐号,设置下次登录修改密码
- 改写:C#里根据Windows本地用户组查询组成员,以及修改密码(System.DirectoryServices.Protocols使用"WinNT://"方式)
- window下mysql本地修改密码
- 域计算机修改修改本地帐号密码
- hmailserver帐号密码修改代码(C#)
- 一种简单的修改所有域内本地管理员密码,及加某个帐号至本地管理员组的方法
- C# 实现在本地记住登录帐号和密码和实现将MD5密码添加到数据库中
- 利用C#结合net use命令破解域帐号密码
- Windows脚本系列之三——使用脚本批量修改本地管理员密码
- 域环境批量修改本地管理员密码
- C#利用win32 Api 修改本地系统时间、获取硬盘序列号
- C#修改AD域的用户密码时报“调用的目标发生了异常”的问题。
- C# 连接SQLite数据库及修改SQLite数据库密码。
- c#修改本地连接的ip
- 忘记MySQL数据库root帐号密码,怎么修改过来?
- 查看Window系列本地账户密码
- mysql忘记root帐号和密码,修改root用户名和密码解决方案