设为首页   加入最爱           最新更新:全方位英文文章资料库
 
资料坊搜索: 标题 全文     
ADSI,使用ASP来完成NT管理
   首页>>YesizeCOM>>电脑技能坊>>ASP>>正文       
 
广告招租,e-mail:yesize@hotmail.com

广告招租,e-mail:yesize@hotmail.com


我上次说的是如何使用ADSI管理web server这次讨论ADSI如何对NT进行管理使用ADSI对IIS进行管理需要OP4而对NT要进行ADSI管理则需要NTLM
NTLM提供以下几个对象: Domain, Group, and User.
通过domain对象你可以增加groups和users.
警告:
以下的例子都将改变NT访问权限数据库;任意增加和改变NT用户的权限
使用前请仔细阅读,请只在测试的机器上运行这些程序,只到你掌握了NTLM
的工作原理为止。千万不要危害到真正主机的安全。
只有拥有Administrator或则Operator权限的人才能够在运行IIS机器上
更改NT的用户数据库。所以,使用Anonymous权限登录是没有权限的。
当然如果使用SSL的话也能够保证安全性。
例子如下:
新建一个用户:
可以在一个独立的服务器上,也可以在一个主域服务器上新增用户
<%

On Error Resume Next

strDomain="MACHINENAME"
strUser="jdoe"

Set oDomain = GetObject("WinNT://" & strDomain)

Set oUser = oDomain.Create ("user", strUser)

If (err.number = 0) Then
oUser.SetInfo
oUser.SetPassword "mypassword"
oUser.SetInfo
Set oUser=Nothing
End If

Set oDomain=Nothing
%>

新增加一个组:
<%

strDomain="MACHINENAME"
strGroup="Unidentified"

Set oDomain = GetObject("WinNT://" & strDomain)

Set oGroup = oDomain.Create ("group", strGroup)

oGroup.SetInfo

Set oDomain=Nothing
Set oGroup=Nothing
%>

把一个用户增加到一个组中.
<%
strDomain="MACHINENAME"
strUser="jdoe"
strGroup="Unidentified"

Set oDomain = GetObject("WinNT://" & strDomain)
Set oGroup = oDomain.GetObject("Group", strGroup)

oGroup.Add ("WinNT://" & strDomain & "/" & strUser)

Set oDomain=Nothing
Set oGroup=Nothing
%>
配置用户信息
<%

strDomain="MACHINENAME"
strUser="jdoe"

Set oUser = GetObject("WinNT://" & strDomain & "/" & strUser)

Setting the Account Expiration to 30 days from today

dtExpirationDate=Now()
dtExpirationDate=DateAdd("d",30,dtExpirationDate)

oUser.AccountExpirationDate = dtExpirationDate

Setting the Full Name of the User
oUser.FullName="Joe Doe"

oUser.SetInfo()

Set oUser=Nothing
%>
继承用户
<%
strDomain="MACHINENAME"
strGroup="Unidentified"

Set Group = GetObject("WinNT://" & strDomain & "/" & strGroup)

For Each Member in Group.Members

If (Member.Class="User") Then

Here is where you would do
something with the user

End If
Next
%>
当你是使用的NT5.0时,就不需要安装NTLM了,因为NT5.0提供对ADSI的支持。


上一篇:在Web页面中执行Windows程序 下一篇:一段ADSI和EXCHANGE结合的示范代码

版权说明:作品来源于网上,版权归作者所有,如果无意中侵犯了您的版权,请来信告知,本站将在3个工作日内删除。yesize@hotmail.com
  热门小游戏分类 
射击小游戏 连连看小游戏
台球小游戏 成人小游戏
CS小游戏 化妆小游戏
赛车小游戏 休闲小游戏
篮球小游戏 换装小游戏
儿童小游戏 牛牛小游戏
麻将小游戏 冒险小游戏
美媚小游戏 益智小游戏
体育小游戏  
Society Recreation & Sports
Travel & Leisure Communications
Vehicles Computers
Fashion Arts & Entertainment
Reference & Education Disease & Illness
Writing & Speaking Politics
Product Reviews Food & Beverage
Finance Internet Business
Self Improvement Home & Family
Health & Fitness Business
最新更新内容
警惕“公务员报考热”背
公务员考试不是丈母娘考
一名新公务员的自白:我
公务员考脑筋急转弯与挂
北努斗:2006行政能力测
大讨论:06行测BT题目大
过来人回忆:当年,我也
一家之言:公务员热折射
公务员考试申论要是有正
数十万大学生走进公务员
      粤ICP备05005424         Copyright ©2000 - 2004 Yesize.COM