Wednesday 4 September 2013

Using DSQUERY to find a list of machines in your domain and output to a text file


List of projector machines!



I was recently asked to get a list of all machines attached to projectors within our organisation, fortunately we have an inteligent naming convention which includes the letters "proj" in any computername used with projector installs.

To accomplish this I used DSQUERY with the following parameters:

DSQUERY COMPUTER domainroot -o rdn -scope subtree -name *proj* -limit 1000 > c:\machines.txt

 This nicely outputted a textfile called machines in the root of my c: drive.

For more info on DSQUERY:

http://social.technet.microsoft.com/wiki/contents/articles/2195.active-directory-dsquery-commands.aspx
http://technet.microsoft.com/en-us/library/cc730720.aspx

Great when there's a quick solution!

How to check the time on your machine is synchronised with your domain:



The check:


Open a command prompt and paste in the following:

echo %TIME%
w32tm /resync
echo %TIME%

You will get an output showing the current time on your P.C. the second command will resync the time on your pc with the domain controller and then show the time again.  If your time is out by 2 or more seconds there may be an issue with how your machine is synchronising it's time. 

Some things to investigate: