Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use vbscript to enumerate the number of computers in a domain

Shulou Source: shulou.com Published: 2022-06-03 06:46:32 11月15日 Update

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!

Tags: Articles number computer code value interest at the same time more friends knowledge editing industry information information channels channels reference learning help support Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Linux Shulou Information Huawei MySQL