取得服务器上用户组列表脚本之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 "

1<table bgcolor="ffffcc" border="1" cellpadding="4" width="90%"><tr align="Center"><td valign="top"> <b><font color="Blue" size="5">"&amp;UCASE(DomainString)&amp;"内的所有组的列表</font></b></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 "

1<font color="Red"> There was an error connecting to " &amp; domainname &amp; "</font>

!

1<br/>

"
set ie=Nothing
wscript.quit
end if

DomainObj.Filter = Array("group")
strInfo="

 1<table border="0" cellpadding="5"><tr><td><b><font size="3">组名</font></b></td><td><b><font size="3">描述   
 2</font></b></td></tr>"   
 3ie.StatusText="正在收集信息,请稍候......"   
 4For Each GroupObj In DomainObj   
 5If GroupObj.Class = "Group" Then   
 6strInfo=strInfo&amp;"<tr><td><b><font size="3">"&amp;GroupObj.Name&amp;"</font></b></td><td><b><font size="3">"&amp;GroupObj.Description&amp;"</font></b></td></tr>"   
 7End If   
 8Next   
 9set DomainObj = Nothing   
10set GroupObj = Nothing   
11strInfo=strInfo &amp; "</table>

"
write strInfo & "

1<br/>

"

write "

1<font size="1"><i>" &amp; Now &amp; "</i></font>

"

set ie=Nothing
set doc=Nothing
wscript.quit

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

Published At
Categories with Web编程
Tagged with
comments powered by Disqus