Exemplo n.º 1
0
        /// <summary>
        /// 创建一个用户
        /// </summary>
        /// <param name="info">用户账户信息结构</param>
        public void CreateUser(NTUserInfo info)
        {
            DirectoryEntry rootad  = getASMDirectoryEntryRoot();
            DirectoryEntry NewUser = rootad.Children.Add(info.Username, "User");

            NewUser.Invoke("SetPassword", new object[] { info.Password });
            NewUser.Invoke("Put", "UserFlags", info.UserFlags);

            NewUser.Properties["Description"].Value = info.Description;
            NewUser.Properties["Fullname"].Value    = info.Fullname;

            NewUser.CommitChanges();
            NewUser.Dispose();
            rootad.Dispose();
        }
Exemplo n.º 2
0
        /// <summary>
        /// ����һ���û�
        /// </summary>
        /// <param name="info">�û��˻���Ϣ�ṹ</param>
        public void CreateUser(NTUserInfo info)
        {
            DirectoryEntry rootad = getASMDirectoryEntryRoot();
            DirectoryEntry NewUser = rootad.Children.Add(info.Username, "User");
            NewUser.Invoke("SetPassword", new object[] { info.Password });
            NewUser.Invoke("Put", "UserFlags", info.UserFlags);

            NewUser.Properties["Description"].Value = info.Description;
            NewUser.Properties["Fullname"].Value = info.Fullname;

            NewUser.CommitChanges();
            NewUser.Dispose();
            rootad.Dispose();
        }