How to use vbscript to enumerate the number of computers in a domain
This article mainly introduces how to use vbscript to enumerate the number of computers in the domain, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to understand it.
The code is as follows:
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 Thank you for reading this article carefully I hope the article "how to use vbscript to enumerate the number of computers in the domain" shared by the editor is helpful to everyone. At the same time, I also hope that you can support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!