Originally posted on the Cyber Advisors blog on May 7, 2018. Updated and expanded below.
Administration of Configuration Manager is more than a full-time job by itself. Maintaining some sort of documentation for the environment that can be given to management or stored internally can be an all together second job. So, why continue a manual task of creating documentation when you could automate it and have an extensive and detailed document created in minutes instead of hours.
In 2013, David O’Brien, https://david-obrien.net, created a massive documentation script, written in PowerShell, that would collect a ton of information from a Configuration Manager environment. He has since moved on from Configuration Manager and posted the last version of his script out on GitHub for everyone to use and possibly expand upon.
For quite some time now, I have wanted to dissect and bring it up to date and make it better in some ways. So, I forked his github repository and over the last month or so, I’ve been nibbling at it here and there in my free time and finally have it at a pretty good place. So, here’s what I did.
The first thing that always bugged me about the script was the requirement for Microsoft Word to write the documentation. Often, it would have been easiest to just run the script from the CM server where Word should never be installed. So, I dumped the first 2000+ lines (needed for MS Word) and built some functions to allow me to write the entire document in HTML. The obvious advantage here was no requirement for Word. All you need is PowerShell. And, the HTML is written in a way, that you can always import it into Word and make any additions or format changes you want after.
So, my updated script contains everything collected from the original and much more. Below is a summary of what’s New (my personal favorites are bolded):
- Removed dependence on Microsoft Word.
- Formatted HTML output.
- Updated to work with Current Branch (1710+).
- Collects everything for Software Updates (ADRS, Config, Packages, Groups)!!
- Full details of your Automatic Deployment Rules.
- Collects important Info for SQL database.
- Collects Site features and servicing history.
- Collect Default Boundary Group settings.
- Extended to include configuration of all the new Client Settings.
- Collects additional Collection information.
- Summarizes Collections with maintenance windows.
- Summary of all the different Compliance settings (Conditional Access, Company resources, etc).
- Updated Endpoint Protection Profile info.
- MUCH more detail on Applications.
- Added OSD Related Items (Installers, Images, Upgrade Packages)
- Lists Task Sequence steps.
- Additional Step Details: Conditions, Nested Task Sequences, Continue on Error
- Site Maintenance tasks with more details.
- Site Roles listed with full details.
- Collect only a Site Summary or detailed information options.
- CM Scripts
I’m maintaining the script out on GitHub. Download the latest version here.
As I have more free time, I’ll be adding more. And as CM continues to evolve, more will come from there as well.
If you have something you want to add, I welcome contributions! Fork it, tweak it, make it better! There have already been some great contributions for the Site Maintenance tasks and site roles! So,if you have ideas of items to add, run into issues running the script, post here or to the Issue tracker on GitHub.
Simply run DocumentCMCB.ps1 like in the sample below:
DocumentCMCB.ps1 -ListAllInformation -CompanyName "Acme Inc."
If you specify "ListAllInformation" be prepared for a very large document and the script to take some time to run.
Additional details on the script, and how to use it, are available in the ReadMe on Github.
Let me know what you think of the updated script!
Downloaded the latest version and it works fantastically on current branch! We are about to decommission our legacy 2012 environment and I want to document as much as I can before shutting it down. I ran the script against it and many of the commands it couldn't process as they were too new. I don't know the history of this script but is there possibly an older version that can be run against 2012 that would be more compatible? Thanks!
The original from David O'Brien will probably be your best bet. That one will require Word to run. But, at least it will give you something. He has it on his git repo out here: https://github.com/davidobrien1985/ConfigMgr/blob/master/DocumentCM12R2v2.ps1
Paul, you are a hero
I LOVE this script!!! I have referred to it to re-create corrupted ADRs and such.
At line 79, I added:
[string]$SMTPServer = "SMTP",
[string]$MailTo = "Richard Crews <ToEmail>",
[string]$MailFrom = "SCCM Monitor <FromEmail>",
[string]$SubjectLine = "SCCM Documentor",
[string]$CopyPath = "DocumentationFolderPath",
At the end I added:
Write-host "Beginning copy of $FilePath to $CopyPath"
Copy-Item $FilePath -Destination "$CopyPath" -Force
Write-host "Sending email."
Send-MailMessage -From $MailFrom -To $MailTo -Subject $SubjectLine -Body "Completed execution at $($ScriptEndTime.ToShortTimeString()) with a total execution time of $ExecTimeString
A copy of the report has been saved to $CopyPath" -Attachments $FilePath -Priority High -SmtpServer $SmtpServer
Glad it helps you out. I like it for stuff like you refer to as well.
I like this idea of sending an email. I see that you added it out on GitHub as well I'll take a look at incorporating these. I'll look at a parameter set for emailing, or feel free to fork and merge request it back in!
I'd be happy to but since I'm a bit of a noob, I don't know what you mean by "fork and merge request it back in".
Thank you for this, it is a great time saver.