Home > Server Virtualization Tips > Managing virtual environments > How to use Active Directory to identify and track virtual machines, part 2
Server Virtualization Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

MANAGING VIRTUAL ENVIRONMENTS

How to use Active Directory to identify and track virtual machines, part 2


Chris Wolf, contributor
07.17.2007
Rating: --- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


In the second part of a three-part series, Chris Wolf looks at how to use a script to query computer object description attributes to locate virtual machines.

In Using Active Directory to Identify and Track Virtual Machines – Part I, I covered a technique for leveraging the computer object Description attribute to differentiate between physical and virtual servers. I also explained how to use a vbscript to modify the Description attribute for a large number of computers.

In this article, I'm going to cover a method for querying Active Directory to find computer objects that match a pre-determined Description attribute prefix. For example, if you wanted to locate all virtual computers, you would need to find all computers whose Description attribute started with "V." To find all Xen-based virtual machines, the query would have to look for computers whose Description attribute started with "Vxen."

While in my last article I explained how to use Active Directory Users and Computers to perform computer object searches, sometimes you may find that you want the output stored in a text file for integration with other management tools or for long term record keeping. With that in mind, the script QueryDescription.vbs, available from my site as a text download, can be used to return a list of computers whose Description attribute starts with a pre-determined string.

To use the script in your environment, there are three variables that you will need to edit:

  • strPrefix
  • strDomainTarget
  • strLogFile

strPrefix identifies the Description attribute prefix to include in the search. For example, setting strPrefix to "V" will return a list of all VMs. If strPrefix was set to "Ps," a list of all physical servers would be returned.

strDomainTarget is used to specify the distinguished name of the domain that you wish to query, and should be set to match your domain name. So if you managed the searchservervirtualization.com domain, strDomainTarget would need to be set to "dc=searchservervirtualization,dc=com." Note that you could also limit the scope of the connection to a single OU by adding to the distinguished name. For example, to connect to the "Web" OU in the TechTarget.net domain, strDomainTarget would need to be set to "ou=web,dc=techtarget,dc=net."

The last variable that may require modification is strLogFile. strLogFile identifies the location of where the script's output log file will be stored. By default, it is set to save to the root directory of the C drive. Here is a sample of what the resultant log file will display:

The following computers have the vesx Description Prefix:

Computer Name
=============
FS1
FS2
Hernandez
Maine
web1
web2
web3

As you can see, tracking virtual machine objects in Active Directory isn't as hard as it looks. Using scripts to modify the Description attribute to identify computers as specific VM types or as physical systems can allow you to quickly put a system in place to more easily track VMs across your enterprise. Once all existing physical and virtual computer objects are set with the appropriate prefix in their description attribute, you will need to ensure that all new computers added to the domain have the correct Description attribute prefix as well (Vesx, Vvi, Vms, etc.). You organization's deployment and change control processes will likely need to be updated to ensure that this occurs.

In the last part of this article series, I explore methods for customizing Active Directory in order to make use of custom virtual machine attributes. If making use of the existing Description attribute is not for you, then hopefully the solution documented in the next article will provide just what you need.

About the author: Chris Wolf is a Microsoft MVP for Windows Server – File System/Storage and is a MCSE, MCT, and CCNA. He's a Senior Analyst for Burton Group who specializes in the areas of virtualization solutions, high availability, enterprise storage, and network infrastructure management.

Rate this Tip
To rate tips, you must be a member of SearchServerVirtualization.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Search More Tips on Virtual Implementation and Virtualization Platforms
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersEvents
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2006 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts