Five free ways to script Active Directory in PowerShell: Part 2


The PowerShell Tool Belt For Active Directory

This is huge.  Today’s post includes demo scripts for all five free ways to script Active Directory in PowerShell.  I presented these last weekend at the first ever PowerShell Saturday event in Columbus, Ohio.  You will also find attached a one hour audio recording of the presentation for those who couldn’t attend in person.  Now you have a free AD scripting recipe book with a guided tour from GoateePFE.

AD Tool Belt

To recap from our last post here are the five techniques we will discuss:

  1. CMD utilities with CSV output wrapped in PowerShell
  2. WMI (cool stuff not documented very well online)
  3. ADSI & ADSISEARCHER
  4. .NET
  5. The Active Directory module (including a Recycle Bin demo)

Each demo file is loaded with comments that will walk you through learning these techniques in your lab.  While most of these scripts are only reading data, some of them will write changes to your lab.  DO NOT RUN IN PRODUCTION.  I have placed a “break” statement at the beginning of each script so that you cannot accidentally run the whole script.  Open each example file in the PowerShell ISE, select each demo line one at a time, and use the Run Selection (F8) button to see the output.  I have also sprinkled in comments with helpful links for more information on each topic.  Some of the examples have hardcoded domain references that you will need to adjust with your lab domain name.

Note that these demos are intended as a high level overview of each technology.  Most of the concepts are documented very well on TechNet or MSDN, and I chose to only demo some of the more popular features as a general introduction.  Leveraging this sample code you can build out some amazing automation for your Active Directory environment.

Find all of this AD PowerShell goodness in the attached ZIP file at the bottom of the post.  For the full PowerShell Saturday experience you can go through each of the files while listening to the audio recording.  Note that the MP3 in the ZIP is highly compressed; you can get the high quality audio version from my SkyDrive here.

PowerShell Saturday

We had a great time at PowerShell Saturday (#pssat) in Columbus, Ohio, and I would like to thank everyone who made this event possible.  It was great to spend the day with all y’all.  (pictured below, named left to right)

PowerShell Saturday

Wes, Ed, Teresa, Brian, and I would like to to thank everyone who attended for making this such a great experience at the first PowerShell Saturday.

 

Feel free to follow me on Twitter @GoateePFE.  If you have any questions you can post them in the comment area or use the Email Blog Author link on the right.  You can also share this post with others via the social media icons below.

PS_AD_Tool_Belt.zip

Comments (3)

  1. Ashley McGlone says:

    Hi Mike,

    The slides only served to introduce the session.  The entire presentation content is contained in the demo files attached.  Enjoy!

    Ashley

  2. Anonymous says:

    Wish I was closer to Ohio, looks like it was a great event.  Can you share the presentation.  I'm going to start playing with them in the lab tomorrow.

    Thanks

    Mike

  3. Anonymous says:

    Welcome! Today’s post includes demo scripts and links from the Microsoft Virtual Academy event: Using PowerShell for Active Directory . We had a great time creating this for you, and I hope you will share it with anyone needing to ramp up their