Add a user in XP and 2000

xiaoxiao2021-03-06  94

private void AddUser (string strDoamin, string strLogin, string strPwd) {DirectoryEntry obDirEntry = null; try {obDirEntry = new DirectoryEntry ( "WinNT: //" strDoamin); DirectoryEntries entries = obDirEntry.Children; DirectoryEntry obUser = entries.Add ( Strlogin, "User"; Obuser.properties ["fullname"]. Add ("amigo"); object obret = Obuser.invoke ("setPassword", strpwd); obuser.commitchanges ();} catch (exception ex) { }

转载请注明原文地址:https://www.9cbs.com/read-123812.html

New Post(0)