如何修改AD帐户信息(立即给分) 请问如何通过代码来修改AD帐户信息??? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 using System.Diagnostics;public void CreateLocalUser(string username, string password, string homedir) { if (!Directory.Exists(homedir)) Directory.CreateDirectory(homedir); Process MyProc = new Process(); MyProc.StartInfo.WorkingDirectory = "C:\WINNT\SYSTEM32"; MyProc.StartInfo.FileName = "net.exe"; MyProc.StartInfo.UseShellExecute = false; MyProc.StartInfo.RedirectStandardError = true; MyProc.StartInfo.RedirectStandardInput = true; MyProc.StartInfo.RedirectStandardOutput = true; MyProc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; MyProc.StartInfo.Arguments = @" user " + username + @" " + password + @" /ADD /ACTIVE:YES " + @"/EXPIRES:NEVER /FULLNAME:" + username + @" /HOMEDIR:""" + homedir + @""" /PASSWORDCHG:NO /PASSWORDREQ:YES"; MyProc.Start(); MyProc.WaitForExit(); MyProc.Close(); } 我想通过代码修改active directory上的帐户信息 请查看LDAP,ADSI,WMI的相关资料 实际上你可以去微软脚本中心http://www.microsoft.com/china/technet/community/scriptcenter/user/default.mspx 去看看 虽然都是wsh脚本,不过所用到的技术和对象都是一样的。 看明白了,转成net代码也不是很困难的事情呵呵,了解解决方案的本质,比了解代码更重要 IComparable和IComper借口排序问题 C# 客户端调用webservice获取DataSet时大小限制 求建议!关于博文存储方式! 不差钱!(文本文件的读取) 在c#.net中用CQueue队列数据结构,多线程同步的问题? 急!!! 有谁用过WMRM10 SDK? 通过Interop操作Word时,怎么得到已知Document的窗口句柄? Ueditor怎么加载数据库中的内容 C#安卓开发无法创建项目 IO问题:C#中如何写文件,才能c/c++中按记录的方式读取? C# 調用inpout32.dll出錯 checkedListBox1的数据库删除添加修改问题
{
if (!Directory.Exists(homedir))
Directory.CreateDirectory(homedir);
Process MyProc = new Process();
MyProc.StartInfo.WorkingDirectory = "C:\WINNT\SYSTEM32";
MyProc.StartInfo.FileName = "net.exe";
MyProc.StartInfo.UseShellExecute = false;
MyProc.StartInfo.RedirectStandardError = true;
MyProc.StartInfo.RedirectStandardInput = true;
MyProc.StartInfo.RedirectStandardOutput = true;
MyProc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
MyProc.StartInfo.Arguments = @" user " + username + @" " + password + @" /ADD /ACTIVE:YES " +
@"/EXPIRES:NEVER /FULLNAME:" + username + @" /HOMEDIR:""" +
homedir + @""" /PASSWORDCHG:NO /PASSWORDREQ:YES";
MyProc.Start();
MyProc.WaitForExit();
MyProc.Close();
}
实际上你可以去微软脚本中心http://www.microsoft.com/china/technet/community/scriptcenter/user/default.mspx
去看看
虽然都是wsh脚本,不过所用到的技术和对象都是一样的。
看明白了,转成net代码也不是很困难的事情呵呵,了解解决方案的本质,比了解代码更重要