枚舉域內(nèi)計(jì)算機(jī)個(gè)數(shù)vbscript腳本(沒環(huán)境,沒測試)
更新時(shí)間:2009年10月20日 22:08:01 作者:
枚舉域內(nèi)計(jì)算機(jī)個(gè)數(shù)的腳本,參考了微軟官方的代碼,有興趣的朋友可以參考下。
原來是微軟專家的代碼在這:
http://www.microsoft.com/china/technet/community/scriptcenter/resources/hey060127.mspx
我改成了全自動式的,不需要手要修改域的adsi連接字符串了,代碼:
On Error Resume Next
Set objRootDSE = GetObject("LDAP://rootDSE")
strDomain = ObjRootDSE.Get("defaultNamingContext")
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = _
"SELECT Name FROM 'LDAP://" & strDomain & "' WHERE objectCategory='computer'"
Set objRecordSet = objCommand.Execute
Wscript.Echo objRecordSet.RecordCount
http://www.microsoft.com/china/technet/community/scriptcenter/resources/hey060127.mspx
我改成了全自動式的,不需要手要修改域的adsi連接字符串了,代碼:
復(fù)制代碼 代碼如下:
On Error Resume Next
Set objRootDSE = GetObject("LDAP://rootDSE")
strDomain = ObjRootDSE.Get("defaultNamingContext")
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = _
"SELECT Name FROM 'LDAP://" & strDomain & "' WHERE objectCategory='computer'"
Set objRecordSet = objCommand.Execute
Wscript.Echo objRecordSet.RecordCount
您可能感興趣的文章:
- ASP、vbscript編碼模板
- ASP中一個(gè)用VBScript寫的隨機(jī)數(shù)類
- 利用vbscript腳本修改文件內(nèi)容,此適用于自動化的操作中
- asp,VBscript語法錯(cuò)誤,史上最全最詳細(xì)最精確
- vbscript腳本編程教程2利用fso來進(jìn)行文件操作
- 使用vbscript腳本在表單中進(jìn)行選擇的代碼
- 用vbscript腳本實(shí)現(xiàn)返回 IP 配置數(shù)據(jù)的代碼
- ASP里面令人震撼地Debug類(VBScript)
- 調(diào)試JavaScript/VBScript腳本程序(IE篇)
- JavaScript/VBScript腳本程序調(diào)試(Wscript篇)
- ASP/VBScript中CHR(0)的由來以及帶來的安全問題分析
- ASP(VBScript)中整除和取余
- ASP基礎(chǔ)知識VBScript基本元素講解
- ASP基礎(chǔ)入門第四篇(腳本變量、函數(shù)、過程和條件語句)
相關(guān)文章
VBS教程:VBscript語句-ExecuteGlobal 語句
VBS教程:VBscript語句-ExecuteGlobal 語句...2006-11-11
用vbs實(shí)現(xiàn)隨機(jī)讀取文件的一行內(nèi)容的腳本
用vbs實(shí)現(xiàn)隨機(jī)讀取文件的一行內(nèi)容的腳本...2007-10-10
用vbs實(shí)現(xiàn)虛擬主機(jī)和域名查循的腳本
用vbs實(shí)現(xiàn)的可以查詢虛擬主機(jī)和域名信息的腳本代碼,保存為vbs運(yùn)行即可2008-06-06
VBS教程:函數(shù)-ScriptEngineMinorVersion 函數(shù)
VBS教程:函數(shù)-ScriptEngineMinorVersion 函數(shù)...2006-11-11
用vbs實(shí)現(xiàn)定時(shí)運(yùn)行web文件的方法
用vbs實(shí)現(xiàn)定時(shí)運(yùn)行web文件的方法...2007-03-03

