VBScript program to enumerate all Servers in the domain. Program outputs the Distinguished Name of
The program uses ADO to find all computer objects, then displays the Distinguished Names of the ones that have the string "server" in the operatingSystem attribute. This is the fastest way to search for servers in the domain. The output will include Domain Controllers and member servers.
The first version of this program retrieved all objects of class "computer" in the domain. Then in the loop where the resulting recordset is enumerated, the program checked the value of the operatingSystem attribute for the string "server". Only rows where this string was found were output. The latest version of this program modifies the filter clause of ADO so the program queries for all computer objects where the operatingSystem attribute includes the string "server" anywhere in the value. The result is the same, but the filter on operatingSystem is now done on the server. The resulting recordset is smaller and the query is more efficient.
EnumServers.txt <<-- Click here to view or download the program