分享
 
 
 

一个关于操作局域网的类

王朝c#·作者佚名  2006-12-17
窄屏简体版  字體: |||超大  

<%

'/*============================================================

'/*此类是转贴于CoCoon.网址:http://www.ccopus.com/LeadBBS/Board/

'/*此类可以获取操作局域网的相关信息

'/*============================================================

Class CC_Net_Tools

'1. Domain Computers

'1.1 Display all domains in the server NameSpace

Sub PullAllDomains

Dim objNameSpace

Dim Domain

Set objNameSpace = GetObject("WinNT:")

For Each Domain in objNamespace

Response.Write "<span style='width:200px'>" & Domain.Name & "</span>"

Next

End sub

'1.2 Display all Connected Computers on the Primary Domain Controller

Sub PullAllComputers(strDomain)

Dim PrimDomainContr

Set PrimDomainContr = getobject("WinNT://" & strDomain)

PrimDomainContr.filter = Array("Computer")

For each Computer in PrimDomainContr

Response.Write "<span style='width:200px'>" & Computer.Name & "</span>"

Next

End sub

'1.3 Remove a Connected Computer from a Primary Domain Controller

Sub DelComputerFromPDC(strDomain,strDelComputer)

Dim PrimDomainContr

Set PrimDomainContr = getobject("WinNT://" & strDomain)

Call PrimDomainContr.Delete("Computer", strDelComputer)

End Sub

'2. Computer Users

'2.1 Display all user accounts

sub PullAllUsers(strDomain)

Dim Computer

Dim User

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

Computer.Filter = Array("User")

For Each User in Computer

Response.Write "<span style='width:200px'>" & User.Name & "</span>"

Next

End Sub

'2.2 Display Minimum Password Age

Sub DispMinPassAge(strDomain)

Dim Computer

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

Response.Write ((Computer.MinPasswordAge) / 86400)

End Sub

'2.3 Display Minimum Password Length

Sub DispMinPassLength(strDomain)

Dim Computer

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

Response.Write Computer.MinPasswordLength

End Sub

'2.4 Display Password History Length

Sub DispPassHisLength(strDomain)

Dim Computer

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

Response.Write Computer.PasswordHistoryLength

End Sub

'2.5 Display Auto Unlock Interval

Sub DispAutoUnlock(strDomain)

Dim Computer

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

Response.Write Computer.AutoUnlockInterval

End Sub

'2.6 Display Lockout Observation Interval

Sub DispAutoUnlockObservation(strDomain)

Dim Computer

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

Response.Write Computer.LockOutObservationInterval

End Sub

'3. Computer Groups

'3.1 Display All Groups

Sub PullAllGroups(strDomain)

Dim Computer

Dim Group

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

Computer.Filter = Array("Group")

For Each Group in Computer

Response.Write "<span style='width:200px'>" & Group.Name & "</span>"

Next

End Sub

'4. User Specific Fields

'4.1 Display User Fullname

Sub PullUserFullname(strDomain,strUser)

Dim User

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

Response.Write User.Fullname

End sub

'4.2 Display User Description

Sub PullUserDescription(strDomain,strUser)

Dim User

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

Response.Write User.Description

End sub

'4.3 Display User Must Change Password Flag

Sub PullUserMustChangePass(strDomain,strUser)

Dim User

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

Response.Write User.Get("PasswordExpired") '// 1 Means the Password Expired

End Sub

'4.4 Display User Can't Change Password Flag

Sub PullUserCannotChangePass(strDomain,strUser)

Dim User

Dim Flags

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

Flags = User.Get("UserFlags")

Response.Write Flags And &H00040 '// 0 Means that user CAN change pass

End sub

'4.5 Display Password Never Expires Flag

Sub PullPassNeverExpires(strDomain,strUser)

Dim User

Dim Flags

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

Flags = User.Get("UserFlags")

Response.Write Flags And &H10000 '// 0 Means that Password DOES expire

End sub

'4.6 Display User Password Minimum Length

Sub PullUserPassMinLength(strDomain,strUser)

Dim User

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

Response.Write User.PasswordMinimumLength

End Sub

'4.7 Display User Password Required

Sub PullUserPassRequired(strDomain,strUser)

Dim User

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

Response.Write User.PasswordRequired

End Sub

'4.8 Display User Account Disabled Flag

Sub PullUserAccountDisabled(strDomain,strUser)

Dim User

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

Response.Write User.AccountDisabled

End Sub

'4.9 Display User Account Lockout Flag

Sub PullUserAccountLockout(strDomain,strUser)

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

Response.Write User.IsAccountLocked

End Sub

'4.10 Display User Account Type

Sub PullUserAccountType(strDomain,strUser)

Dim User

Dim Flags

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

Flags = User.Get("UserFlags")

Response.Write Flags And &H100'// 0 Means that account is GLOBAL

End sub

'4.11 Display User Profile Path

Sub PullUserProfilePath(strDomain,strUser)

Dim User

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

Response.Write User.Profile

End Sub

'4.12 Display User Login Script

Sub PullUserLoginScript(strDomain,strUser)

Dim User

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

Response.Write User.LoginScript

End Sub

'4.13 Display User Home Directory Path

Sub PullUserHomeDirPath(strDomain,strUser)

Dim User

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

Response.Write User.HomeDirectory

End Sub

'4.14 Display User Home Directory Mapping

Sub PullUserHomeDirDrive(strDomain,strUser)

Dim User

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

Response.Write User.Get("HomeDirDrive")

End Sub

'4.15 Display User Account Expiration Date (NT 4.0 only)

Sub PullUserAccountExpireDate(strDomain,strUser)

Dim User

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

Response.Write User.AccountExpirationDate

End Sub

'4.16 Display User Bad Login Count (NT 4.0 only)

Sub PullUserBadLoginCount(strDomain,strUser)

Dim User

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

Response.Write User.BadLoginCount

End Sub

'4.17 Display User Last Login (NT 4.0 only)

Sub PullUserLastLogin(strDomain,strUser)

Dim User

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

Response.Write User.LastLogin

End Sub

'4.18 Display User Last Logoff (NT 4.0 only)

Sub PullUserLastLogoff(strDomain,strUser)

Dim User

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

Response.Write User.LastLogoff

End Sub

'4.19 Display User Last Logoff (NT 4.0 only)

Sub PullUserLastLogoff1(strDomain,strUser)

Dim User

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

Response.Write User.LastLogoff

End Sub

'4.20 Display User Logon Hours Restriction(NT 4.0 only)

Sub PullUserLogonHourRestriction(strDomain,strUser)

Dim User

Dim RegTime

Dim Restrict

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

For Each RegTime In User.LoginHours

If RegTime < 255 Then Restrict = True

Next

Response.Write Restrict

End Sub

'5. Group Specific Fields

'5.1 Display All Users in a Group

Sub PullAllUserFromGroup(strDomain,strGroup)

Dim Group

Dim User

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

For Each User in Group.Members

Response.Write "<span style='width:200px'>" & User.Name & "</span>"

Next

End Sub

'5.2 Display if a Users is listed in a Group

Sub DispUserInGroup(strDomain,strGroup,strUser)

Dim Group

Dim User

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

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

Response.Write Group.IsMember(User.ADsPath)

End Sub

'5.2 Display Group Description

Sub PullGroupDescription(strDomain,strGroup,strUser)

Dim Group

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

Response.Write Group.Description

End Sub

'5.2 Display Which Group a User is Listed in

Sub DispUserInWhichGroup(strDomain,strGroup,strUser)

Dim Group

Dim User

Set User = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

For Each Group in User.Groups

Response.Write Group.Name

Next

End Sub

End Class

%>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有