大河原邦男画集:超级高难问题 利用ASP控制修改AD帐号
来源:百度文库 编辑:神马品牌网 时间:2024/05/03 06:20:52
晕
ASP的不知道
.Net的给你点例子 你能看懂的
创建用户方法
DirectoryEntry de=new DirectoryEntry();
de.Path="LDAP://celticrain/CN=Users,DC=eichkogelstrasse,DC=local";
DirectoryEntries users=de.Children;
DirectoryEntry user=users.Add("CN=John Doe","user");
user.CommitChanges();
public class AdUser : AdItem
{
// http://msdn.microsoft.com/library/en-us/dnclinic/html/scripting09102002.asp
public DateTime PasswordExpirationDate
{
get
{
if(IsPasswordNotExpire)
{
return DateTime.MaxValue; // 帐号被设置为密码永不过期
}
else
{
long lastChanged;
try
{
lastChanged = GetLongValue((IADsLargeInteger)Properties["pwdLastSet"][0]);
}
catch(Exception)
{
return DateTime.MinValue; // 密码没有被设置过
}
IADsLargeInteger maxAge = (IADsLargeInteger)Server.Properties["maxPwdAge"][0];
if(maxAge.LowPart == 0)
return DateTime.MaxValue; // 域中密码没有设置最大有效期限
else
return PasswordLastChanged.AddDays(Server.MaxPasswordDays);
}
}
}
}
用FSO吧.