PowerShell and Visio – Documenting AD: 1
If we take the concept of our last script that added objects to a drawing we can use this as the basis of a way to automate the documentation of our AD.
One of the first things we need to document is the OU structure. If you have ever produced one of these it is a tedious affair and they are difficult to maintain. So lets automate it.
This is how we create a basic OU structure.
The basic changes from last time are that I’m starting with a blank drawing and adding the Active Directory stencil. Objects are added and resized as before. I’m also using the directory connector object rather than the default connector.
If you look at the positions of the objects you can see that I’m automatically aligning them in vertical columns by defining the X co-ordinate.
This script is OK as an experiment to discover how things work but we usually have a lot more objects than this and the depth of the child OUs needs to be considered. We need to be able to read in the OU data and move some of this activity into functions so we can reuse the code.
That’s the next job.