Here is the promised second part of my preview/guide to the AD Info BETA. This post will cover creating your own custom queries if you can’t find a built in query that meets your requirements.
UPDATE 15/02/2011 – The first official release of AD Info is now available here
If you would rather watch a video instead of just seeing screenshots and text, please take a look at this post.
Click here for part 1 of this guide.
Before I go through this custom query creation feature, I should point out that I have not yet decided if this feature is going to be in the free version or if it will end up only being in the paid for version (which will still be a lot cheaper than other AD reporting tools). Hopefully this will not be a big issue for most people as there will be over 50 built in queries anyway and with the ‘User Specified Value’ feature (see part 1 of this guide for more info and examples) you get a lot more use out of a single query than with other AD reporting apps. For example, instead of just having an “All users that are members of Domain Admins” query like most AD reporting tools do, AD Info will have an “All users that are members of the specified group” query that lets you specify any group you want. Anyway, I will confirm if this custom query creation feature will be in the free version or not closer to the final release date.
OK so let’s say you want to create your own custom query, maybe there is no built in query that queries the attribute you want or maybe you often need to run one of the built in queries that lets you specify your own value but you always use the same value so would like a report that always uses this value. All you need to do is go through the simple New Query process and you have your own custom query that does exactly what you want – that is what will be covered in this post in a moment. Before that though I just want to mention that you can easily share your custom query definitions with colleagues by placing the XML file that defines your new query in a location that they can also access, such as on a network drive. The XML file gets created by AD Info when you create your new query and will be saved to your “default query file location” unless you manually choose to save it somewhere else. The default query file location (along with several other settings) can be manually specified in the program or can be set by Group Policy to make it easier for multiple admins to share the same configuration.
The default query file location is where new queries that you create get saved, but it is also one of the locations where the program looks for query definitions when it is launched. Any query XML files in this location (or any of the other query file locations that you have added) will appear in your list of available queries when you open AD Info. So you and all of your colleagues are all using the same default query file location (or at least all have each other’s default locations added to your list of query file locations) then when one of you creates a new query everyone else will automatically see it next time they launch the program. Hopefully this will be a useful feature in larger IT departments and is the reason for enabling this setting to be configurable via Group Policy.
Anyway, onto the actual process of creating a new query.
First of all we go to the Query menu at the top of the program and select New Query (but I think you could have worked that out yourselves). We then see the following window, which asks us if we want to create a blank new query or if we want to copy the parameters already defined in an existing query, essentially using that as a base for our new query. This is to help save you some time if you want to create a query that is the same as an existing query but just with an additional parameter etc.
Click screenshots to enlarge
In this example we are going to create a custom query that finds all computer accounts with an OS of Windows XP that were created before a specified date. So we will select to copy parameters from the “Computer created before” query as this is a built in query that finds all computers with a creation date earlier than a user specified date. We then click Next, which brings us to the main new query design window shown below and because we selected to copy that other query, we already have the query type (Computers) and one parameter (Creation Date is earlier than [user specified value]) defined for us.
So we are going to give this query a name, lets say “XP machines created before specified date” and we are then going to click the Add button to add another parameter so that we can specify we want the OS to be Windows XP Professional. So now we see the Add Parameter dialog which lets us select the computer attribute we want to query and what we want this attribute’s value to be for it to be considered a match for our query. So I have selected the “Operating System” attribute and the “is” operator (we could have used the “contains” operator if we just wanted to specify part of the OS name).
Now to specify what I want this value to be, I click the Edit Value button and this will provide me with a suitable window where I can specify the type of value that this attribute expects. So for example if I had selected the computer’s Primary Group attribute then it would give me a window where I can enter a group name and check it exists in AD, if I had selected the Parent Container attribute it would give me a window where I can select the OU from a visual domain tree, if it was the Last Logon Date attribute it would give us a calendar to select the date etc etc. In this case though, as the Operating System attribute is just a plain text string, it gives us a simple text box to enter our value into and I have entered Windows XP Professional.
As you can see from the screenshot, if we wanted this to be a user specified value then we would have ticked the “Prompt the user to enter the value when they run the query” checkbox. So we click OK and then back on the new query window we can see this parameter has been added to our list of parameters for this new query.
You can also see that the Save To path has been automatically set to my default query file location (discussed earlier in this post) but we do have the option to save it somewhere else if we want to, or to not save it at all and just run the query as a one off.
Now that we have configured the query exactly as we want, we click OK to save the query and add it to our list of available queries. So now we can run it just like any of the built in queries and it will find any computer accounts that match the parameters we configured. Easy as that! 🙂
Let me know if you have any comments, suggestions, or general feedback. BETA should be released within the next 10 days but I will make another post as soon as it is available.