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.
To recap from our last post here are the five techniques we will discuss:
- CMD utilities with CSV output wrapped in PowerShell
- WMI (cool stuff not documented very well online)
- ADSI & ADSISEARCHER
- 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.
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)
- Brian Jackett, @BrianTJackett, Microsoft PFE, Spoke about SharePoint and PowerShell
- Trevor Sullivon, @pcgeek86, Honorary Scripting Guy, Spoke about WMI and PowerShell
- Ed Wilson, @ScriptingGuys, The Microsoft Scripting Guy, Taught three sessions on PowerShell for Beginners
- James Brundage, @JamesBru, Founder of Start-Automating, Spoke about Pipeworks
- Wes Stahler, @stahler, President of Central Ohio PowerShell User Group, Lead #pssat planner
- Ashley McGlone, @GoateePFE, Microsoft PFE, Spoke about Active Directory and PowerShell
- Daniel Cruz, @cruz_daniel, 2011 Scripting Games Finalist, Spoke about Exchange and PowerShell
- Teresa Wilson, @ScriptingWife, Amazing wife of Ed, Huge help to #pssat
- Lisa Gardner, @SQLGardner, Microsoft PFE, Volunteered to help with the event, Thank you!
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.