This PowerShell script walks an AD OU, collects useful server details, and writes one Markdown file per server for MKDocs.
The Markdown is tuned for Material for MkDocs with admonitions, card grids, and collapsible detail sections.
- Server name and DNS name
- Operating system and version
- Latest hotfix seen plus the 10 most recent hotfixes
- Last boot time and uptime
- Disk size and free space for every local disk
- Memory, model, serial number, and basic network details
- Reachability and collection errors so gaps are obvious in the output
Generate-ServerInventoryDocs.ps1: main report generatorUpdate-InventoryRepo.ps1: optional wrapper to generate docs and commit them into Gitdocs/servers/*.md: generated output location by defaultdocs/servers/SAMPLE-SRV01.md: sample output you can preview in MkDocs right away
$credential = Get-Credential
.\Generate-ServerInventoryDocs.ps1 `
-SearchBase "OU=Servers,OU=Production,DC=contoso,DC=com" `
-DomainController "dc01.contoso.com" `
-OutputPath ".\docs\servers" `
-Credential $credentialIf the account running the script already has access to AD and remote WMI/CIM on the target servers, you can omit -Credential.
Use Task Scheduler, a CI runner on a Windows host, or an existing automation server to run the script nightly. A common pattern is:
- Pull the Git repo onto a Windows machine that can reach AD and the servers.
- Run
Generate-ServerInventoryDocs.ps1. - Commit the changed Markdown files.
- Push to the repo that triggers your MKDocs runner.
If you want one command to handle generation plus Git commit:
$credential = Get-Credential
.\Update-InventoryRepo.ps1 `
-SearchBase "OU=Servers,OU=Production,DC=contoso,DC=com" `
-DomainController "dc01.contoso.com" `
-OutputPath ".\docs\servers" `
-Credential $credential `
-Push- The script expects the
ActiveDirectorymodule to be available. - Remote server collection uses CIM queries. Make sure firewall and permissions allow that from the runner.
- Unreachable servers still get a Markdown page so the absence of data is visible.
- For the intended look in Material for MkDocs, enable the usual extensions for admonitions/details and markdown-in-HTML styling.