The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,310 other followers

Archive for May 13th, 2014

Using dsquery and dsget to get computer information from a domain

Posted by jpluimers on 2014/05/13

This article is a very brief example of how to use dsquery/dsget/find to get computer information from in the active direrctory of a domain.

The main aim for myself is to condense the information here, and have some links for background information.

If you have the right credentials then the below batch file works very well.

It uses these tools:

  • dsquery to query the active directory on your domain controller for the existence and Distinguished Name (or ID/path) of various objects (in this example dsquery computer to check if a computer exists in a domain)
  • dsget which can get you various detail information about an object (for instance dsget computer used in this example))
  • find to raise the correct errorlevel (and indicate if we indeed found a CN – or Common Name – from a distinguished name)

The ds* tools do not raise any errorlevel, so that’s what find is used for.

Further reading: Read the rest of this entry »

Posted in Batch-Files, Development, Power User, Scripting, Software Development, Windows, Windows 7, Windows 8, Windows Server 2000, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Vista, Windows XP | Leave a Comment »

 
%d bloggers like this: