Directory Services

Guy recommends :
Free Solarwinds
VM Console

Solarwinds VM Console Free Download

Find out which of your VMs are a waste of space and which VMs need more resources.


DSGet Command Line Tool for Active Directory 2003

DS built-in tools for Windows Server 2003

DSGet is a logical progression from DSQuery.  The idea is that when DSQuery returns a list of objects, DSGet can interrogate those objects for extra properties such as, description, manager or department.  Naturally this pre-supposes you entered the relevant information in the user's properties sheet!

Contents for DSGet

 ♦

Introduction to DSGet

My assumption is that you are comfortable with DSQuery, if this is not the case take the time to have a refresher and study DSQuery.

Next a reminder to pay close attention to DS syntax.  In this instance what we need is a pipe symbol ( | ) to join DSQuery with DSGet.  Just to be clear, you type this pipe (|) with the shift key and the key next to the Z.  (A colon : would produce an error).

Example 1 To Check that DSQuery is working

Let build a solid foundation with a DSQuery (Only found on a Windows Server 2003 DC)

dsquery user domainroot -name smith*
or
dsquery user -name smith*

Learning Points

Note 1:  You need a Windows Server 2003 machine.  Perhaps you could remote desktop into such a server?

Note 2:  Feel free to change smith* to one of your users.  Better still, create a test account and start filling in those user properties.

Note 3:  This example is just to build a foundation.  Now let us move on to DSGet.

Example 2 Basic DSGet

We need to interrogate the output for more information.  So we use DSGet to retrieve the description.

dsquery user domainroot -name smith*
or
dsquery user -name smith* | dsget user -dn -desc

Learning Points for DSGet

Note 1:  Master the pipe command | which separates dsquery from dsget.  To create |, Hold down the shift key while pressing the key next to the Z.

Note 2:  Even though dsquery told the operating system it was a user object, dsget still has to invoke user in its section of the command.

Challenge:  See what happens if you omit the -dn.

Guy Recommends:  Solarwinds' Free Bulk Import ToolFree Download Bulk Import Tool

Import users from a spreadsheet.  Just provide a list of the users with their fields in the top row, and save as .csv file.  Then launch this FREE utility and match your fields with AD's attributes, click and import the users.  Optionally, you can provide the name of the OU where the new accounts will be born.

There are also two bonus tools in the free download, and all 3 have been approved by Microsoft:

  1. Bulk-import new users into Active Directory.
  2. Seek and zap unwanted user accounts.
  3. Find inactive computers.

Download your FREE bulk import tool.

Example 3 - Which extra properties shall we query?

-display  Display name is different from the user's description field.  If you haven't done so already, time to get a user's properties sheet and start filling in those attribute boxes.

-office  Useful property

-sn This command does not work.  What's the matter with -sn?  I will tell you what's wrong; dsget requires -ln instead of -sn and -fn instead of givenName   grrrrrrrrrrrrrrrrrr.  Calm down Guy, go with the flow; think of all these useful switches.

O.K. No more moaning.  DSGet is actually fun and productive.  Guess what information these switches return?

-email, -tel, -mgr, -mobile

Answers: General (tab), email address, telephone number,  Organization (tab), Manager, Telephones (tab), Mobile.

Now find them on the user's properties sheet.

°

Example 4 - Change the DSget output.

They say the old tricks the best, so let us try exporting the DSGet output not to screen but a text file.  Here we need a different type of pipe command; this time it's the greater than symbol, for example,  > filename.txt.  So, just tag on > filename.txt to your DS command.  Follow up with:  notepad filename.txt.

dsquery user domainroot -name smith*
or
dsquery user -name smith* | dsget user -fn -ln -mgr > dsget.txt

Learning Points

Note 1: To read the file type, notepad dsget.txt

Note 2: I am impressed by the column format of the output

I would like to leave you with a few more DSGet object that you can interrogate or experiment with.  In addition to user, there are the following DSGet commands : Computer, also Server - meaning DC,  OU, Group, even Site and Subnet.

Note. There are also two commands called partition and quota, however, in the context of DSGet, partition and quota refer to Active Directory, not disk.  For example, the application partition in Active Directory.  Tell the truth, it was a big disappointment that DSGet did not return the disk information, but on reflection I was expecting the impossible.  DSGet partition means Active Directory partition.

Summary - DSGet

As far as DSGet is concerned, I have come from Philistine to champion.  Now I really enjoy the challenge of DSGet and appreciate the way it works hand in glove with DSQuery.  It also reminds of that old truism the more you know the easier it gets.

If you like this page then please share it with your friends

 


See more of the DS family of built-in Active Directory utilities

DSQuery   • DSQuery User   • DSQuery Group

• DSGet - List the properties of an object   • DS Commands   • WSH - Create a user

• DSMod - Modify Active Directory attributes    • DSAdd - Create new accounts


 *


Custom Search

Guy Recommends: WMI Monitor and It's Free!Solarwinds WMI Monitor

Windows Management Instrumentation (WMI) is one of the hidden treasures of Microsoft operating systems.

Fortunately, Solarwinds have created the Free WMI Monitor so that you can actually see and understand these gems of performance information.  Take the guess work out of which WMI counters to use for applications like Microsoft Active Directory, SQL or Exchange Server.

Download your free copy of WMI Monitor

 

Home Copyright © 1999-2012 Computer Performance LTD All rights reserved

Please report a broken link, or an error.