Tip

Write Active Directory management scripts automatically

Serdar Yegulalp, Contributor

Back in December I wrote about a remarkable free tool from Microsoft called  Scriptomatic, which helps you write Visual Basic scripts to work with Windows Management Instrumentation (WMI). Since WMI is on the

    Requires Free Membership to View

arcane side (like many other scriptable/programmable Windows interfaces), it's always a blessing to get whatever help you can in putting together scripts to work with it.

Now "The Scripting Guys" at Microsoft (yes, that's how they bill themselves) have created ADSI Scriptomatic, a follow-up to the original Scriptomatic. But instead of writing scripts for WMI, this tool writes scripts for the Active Directory Search Interfaces (ADSI). Basically, it helps you create scripts to do common tasks with Active Directory, such as creating, reading, writing or deleting an object in AD, with the object types being a user, computer, contact, group or organizational unit.

The tool itself is fairly simple. Unpack it anywhere (it doesn't need to be installed to work), run it, and select both an action and an AD object type from the two drop-downs at the top of the form. When you do this, a sample script with comments will be generated in the body of the form, with each step of the code commented. Obviously, this code doesn't have to be used entirely as is: If you just want to scavenge the generated code for a single statement or two -- such as how to read and interpret the values for a single property in a given object -- that's fine (and is, in fact, its intended use).

Click on the Save button to write the results out to a finished script, or you can simply copy and paste from the open window into whatever code you're working on. Click Run, and the code currently in the code window (which can be edited in place, by the way) will be executed from a command-line script session.

 


Serdar Yegulalp is editor of the Windows Power Users Newsletter. Check it out for the latest advice and musings on the world of Windows network administrators -- and please share your thoughts as well!


More information from SearchWinSystems.com


This was first published in February 2006

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.

    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.