top
Loading...
取得服務器上用戶組列表腳本之VBS版
'groups.vbs
'時間:2001.2.5
'版本:1.0
'作者:滄海笑一聲
'其它:此腳本原作者寫于2000年初,滄海用過后覺得不是很好用.
'它原來的顯示方式是wsh的方法,往往要多屏顯示,而且不能保存結果
'我將之改成IE顯示的方法,用起來方便些.:)

On Error Resume Next
'dim wshell
dim ie,doc

set ie = createobject("internetexplorer.application")
ie.navigate "about:blank"
ie.visible = true

set doc = ie.document

CRLF=CHR(13)+CHR(10)
DomainString =inputbox("請輸入一個域名:")
msgbox "域名是:"&DomainString

write "<Table border=1 cellpadding=4 width=90% bgcolor=ffffcc><TR Align=Center><TD valign=top> <B><Font
Size=5 Color=Blue>"&UCASE(DomainString)&"內的所有組的列表</B></Font></td></tr></table>"
doc.title=UCASE(DomainString) & " - 組"

Set DomainObj = GetObject("WinNT://" & DomainString)
tmp= DomainObj.MinPasswordLength 'verify this is a valid domain
if err.number<>0 then
write "<Font Color=Red> There was an error connecting to " & domainname & "</Font>!<br>"
set ie=Nothing
wscript.quit
end if

DomainObj.Filter = Array("group")
strInfo="<Table border=0 cellpadding=5><TR><TD><B><Font Size=3>組名</Font></B></TD><TD><B><Font Size=3>描述
</Font></B></TD></TR>"
ie.StatusText="正在收集信息,請稍候......"
For Each GroupObj In DomainObj
If GroupObj.Class = "Group" Then
strInfo=strInfo&"<TR><TD><B><Font Size=3>"&GroupObj.Name&"</Font></B></TD><TD><B><Font
Size=3>"&GroupObj.Description&"</Font></B></TD></TR>"
End If
Next
set DomainObj = Nothing
set GroupObj = Nothing
strInfo=strInfo & "</Table>"
write strInfo & "<br>"

write "<font size=1><I>" & Now & "</I></Font>"

set ie=Nothing
set doc=Nothing
wscript.quit

'******************
sub write(str)
doc.body.insertAdjacentHTML "beforeend", str
end sub

北斗有巢氏 有巢氏北斗