If you ever need to know the number of computers in your domain there is an easy way to perform the search utilizing the K1000 Appliance and a command run on your Domain Controller.  


An LDAP query will show you the number of existing computer accounts but it cannot distinguish which accounts have not been used for a give period of time (Since you last retired computers)  If you are not unjoining your computers from the domain before you retire them, then you will likely have stale records in AD.  This can be a problem if you are trying to get a count of computers to purchase a computer based software license (such as a new K1000 or are adding nodes to a K1000)


In the K1000 Appliance, go to Home > Labels > LDAP Labels.

Create a new LDAP Label and enter the servername or IP, and the port 389 (636 if you use LDAPS)

Also enter an administrative LDAP login (in the format of domain\username) and LDAP Password.

Click LDAP Browser, then click Test.

If the connection is successful then click next.

The Search Base DN should already be at the root of your Domain.

In the Search Filter box enter: (objectcategory=computer)

Make a note of the Search Count in the right hand pane.


Now log into your Domain Controller and open a command prompt.

Run the command: "dsquery computer -inactive X"  Where X is the number of weeks since you last retired a system. (If it has been 2.5 weeks then enter 2) Make note of the number of results.

Next, Run the command "dsquery computer -disabled"  Make note of the number of results.

If you have a large number of results you can have the command output to a text file by adding  "> c:\inactive.txt" or "> c:\disabled.txt" to the end of your commands.  Open the file in notepad (make sure Word Wrap is off and Status Bar is on) Go to the last line of the document and your count will be shown in the bottom right corner as "Ln X" The X is your count.


Now for some basic arithmetic.

For a count of all active systems use the following formula

(K1000 Count) - (# inactive) - (#disabled) = Total Active

If you are adding nodes to your K1000 use the following formula

(K1000 Count) - (# inactive) - (#disabled) - (Current # in K1000 Inventory) = Total Nodes to purchase.


I hope this has been helpful.