Turn "Read the Source to Understand It" into Documentation Someone Can Actually Operate From — for Any PowerShell Module
An AI-assisted workflow to inventory a module's real command surface and generate a complete, verified documentation package — command reference, permissions, examples, and all — that matches the code instead of the intent.
Executive Brief
Your Challenge
Your module's functions are technically sound, and it's still hard for anyone else to adopt. The comment-based help was copied between commands, parameters changed without the docs catching up, examples only show the happy path, and the README reads like marketing. A new administrator can't tell whether the module fits the task; an automation engineer can't tell which output properties are stable; a security reviewer can't tell what privileges a command actually needs. The code works — but nobody can operate it without reading it.
Common Obstacles
The obvious fix — ask AI to write the docs — is exactly where this goes wrong. AI-generated documentation sounds authoritative while describing behavior the code doesn't implement: invented output types, assumed accepted values, compatibility claimed for platforms nobody tested, parameter text copied from the wrong command. Documentation that confidently contradicts the code is worse than none, because users trust it — they run commands with excessive privileges, automate against output that isn't stable, and deploy in unsupported environments.
The ABME Approach
This workflow inventories before it writes. First you gather the whole module — manifest, public and private functions, tests, existing docs — because tests reveal behavior the implementation alone hides. The primary prompt then reconciles the manifest's declared exports against the actual command surface and flags every discrepancy before a word of documentation is written. Documentation is generated per exported command from validated behavior only, with unverified claims explicitly labeled. A 31-point validation checklist and a Pester documentation-coverage suite prove the docs match the code, so the package becomes an operational and security control rather than a publishing afterthought.
Insight Summary
A PowerShell module is not complete when the code works. It is complete when a qualified user can understand what it does, operate it safely, and depend on its documented interfaces without reading the source.
Provide source code and tests together. Tests often reveal behavior — pipeline binding, failure modes, output shape — that is not obvious from the implementation alone.
Reconcile the manifest's declared exports against the actual command surface before writing anything. A command that appears public but isn't exported, or is exported but undocumented, is a defect the inventory catches and the prose would hide.
AI-generated documentation sounds authoritative while describing behavior the code does not implement — so every output type, accepted value, and compatibility claim must be labeled unverified until validated against the module.
Public output schemas are interfaces. Users automate against object properties, so an output change should be documented and versioned as a breaking change.
Document the smallest confirmed permission set, not "administrative access may be required" — vague permission language pushes users to over-privilege as compensation.
The Journey
Three phases; each lists the tools you'll use there.
Gather the Module and Its Evidence
- Gather the module directory, manifest, public and private functions, and format/type files
- Collect existing README, help files, examples, and Pester tests
- Record supported versions, platforms, authentication, permissions, and license
- Run the inventory commands to capture the real exported command surface
Inventory, Reconcile, and Generate
- Run the primary prompt with the module, tests, and existing documentation
- Review the exported-command inventory and code/doc discrepancy report before accepting any prose
- Apply follow-up prompts for comment-based help, README, PlatyPS Markdown, output objects, and permissions
- Standardize documentation against the parameter, syntax, output, and permissions standards
Validate and Operationalize
- Run the 31-point validation checklist against the generated package
- Run the documentation Pester tests and the six documentation test passes
- Build external help through the PlatyPS pipeline and complete the release checklist
- Assign documentation maintenance ownership and wire coverage checks into CI
What's Inside the Execution Layer
Numbered deliverables grouped by phase. Membership unlocks every tool.
Prerequisites Checklist
- Collect the whole module directory and tests before prompting
- Surface supported versions, platforms, and permissions up front
- Ensure source and tests are provided together
Before using this workflow, gather:
Module Documentation Inventory
- Capture exported functions, aliases, and required modules
- Read manifest data without importing the module
- Reconcile static exports against dynamic exports
Import and inspect the module
List exported commands
Read manifest data without importing
Reconcile static and dynamic
Module Documentation Prompt Pack
- Inventory exports and flag code/documentation discrepancies before writing
- Generate comment-based help, README, and PlatyPS Markdown
- Produce authentication, permissions, troubleshooting, and compatibility documentation
Primary Prompt
Start here with the module, its tests, and any existing documentation.You are a senior PowerShell module maintainer and technical documentation specialist. I will provide a PowerShell module, including its manifest, public functions, private functions, tests, examples, and any existing documentation. Your task is to generate a complete, accurate documentation package based only on the module's actual implementation and validated behavior. Before writing documentation: 1. Summarize the module's purpose. 2. Identify: • Root module • Module manifest • Exported functions • Exported aliases • Exported cmdlets • Exported variables • Public functions • Private functions • Required modules • Optional modules • Type files • Format files • Nested modules • External executables • External services • Configuration files 3. Compare the module manifest exports with the actual command surface. 4. Identify commands that appear public but are not exported. 5. Identify commands that are exported but appear undocumented. 6. Identify aliases and whether they should be documented. 7. Identify supported PowerShell versions from: • Manifest • Syntax • Dependencies • Tests • CI configuration • Existing documentation 8. Identify supported operating systems and platforms. 9. Identify authentication requirements. 10. Identify required roles, privileges, API scopes, and filesystem permissions. 11. Identify input types and pipeline behavior. 12. Identify output types and object schemas. 13. Identify state-changing commands. 14. Identify commands supporting: • WhatIf • Confirm • ShouldProcess • Pipeline input • Wildcards • Paging • Batching • Parallelism • Retry behavior 15. Identify known errors, warnings, and failure conditions. 16. Identify behavior that is unclear or cannot be confirmed. 17. Identify discrepancies between: • Code • Tests • Manifest • Existing help • README • Examples Do not write final documentation until the inventory and discrepancy review are complete. Then create documentation for each exported public command. For every command, include: • Name • Synopsis • Description • Syntax • Parameter documentation • Required and optional status • Accepted input types • Pipeline input behavior • Wildcard support • Default values • Validation rules • Accepted values • Output type • Output-property description • Side effects • Required permissions • Authentication requirements • Error behavior • Examples • Notes • Related commands • Compatibility considerations • Security considerations where relevant For each parameter: • Use the exact implemented name. • Document aliases. • Document position. • Document whether it is mandatory. • Document whether it accepts pipeline input. • Document whether it accepts pipeline input by property name. • Document validation attributes. • Document defaults. • Document null and empty-value behavior. • Do not invent accepted values. For examples: • Include a basic example. • Include a realistic administrative example. • Include pipeline usage where supported. • Include WhatIf usage for state-changing commands where supported. • Include error-handling or automation usage where valuable. • Do not use real credentials, tenant IDs, customer names, or private endpoints. • Clearly label placeholders. • Do not claim an example works unless supported by the implementation. Create the following module-level documentation where applicable: 1. README 2. Installation guide 3. Quick-start guide 4. Authentication guide 5. Permissions guide 6. Configuration guide 7. Command index 8. Troubleshooting guide 9. Security considerations 10. Compatibility matrix 11. Known limitations 12. Upgrade and migration guidance 13. Contribution guidance 14. Release checklist 15. Documentation maintenance guidance Requirements: • Do not invent behavior. • Clearly label unverified assumptions. • Use consistent terminology. • Preserve exact command and parameter names. • Distinguish public commands from internal helpers. • Do not expose secrets or sensitive configuration. • Do not describe deprecated behavior as recommended. • Document breaking changes explicitly. • Document output objects accurately. • Document side effects and privilege requirements. • Prefer task-oriented examples over trivial examples. • Ensure documentation is understandable without requiring source-code review. • Keep command reference factual and operational. • Keep README content concise enough to support discovery and onboarding. After generating the documentation, provide: 1. Documentation coverage report. 2. Exported-command coverage table. 3. Missing or ambiguous behavior. 4. Code and documentation discrepancies. 5. Recommended code changes needed to improve documentation accuracy. 6. Recommended tests needed to verify examples. 7. Suggested PlatyPS workflow. 8. Suggested documentation build and release process. 9. Suggested maintenance ownership.
Generate Comment-Based Help
To insert help blocks into every exported function.Generate complete comment-based help for every exported function. Include: • .SYNOPSIS • .DESCRIPTION • .PARAMETER • .EXAMPLE • .INPUTS • .OUTPUTS • .NOTES • .LINK Preserve the function code and insert documentation only. Do not invent unsupported examples or output types.
Generate a README
To produce the discovery and onboarding entry point.Create a production-quality README for the module. Include: • Module purpose • Primary use cases • Features • Requirements • Installation • Import • Quick start • Authentication • Permissions • Common examples • Command index • Configuration • Compatibility • Security considerations • Troubleshooting • Known limitations • Support • Contribution • License Keep detailed command reference outside the README and link to it.
Generate PlatyPS Markdown
To produce publishable command-reference pages.Generate PlatyPS-compatible Markdown help for every exported command. Use consistent headings, parameter metadata, examples, inputs, outputs, and notes. Do not include private functions.
Document Output Objects
When output schemas must be treated as interfaces.Inspect every exported command and document its output. For each command, identify: • .NET type • PowerShell type name • Custom object properties • Property types • Nullable properties • Status values • Error-result objects • Collection behavior • Output order • Whether output changes with parameters Clearly identify output that cannot be confirmed through static review.
Create an Authentication Guide
For modules with multiple authentication methods.Create a complete authentication guide for this module. Document: • Supported authentication methods • Recommended method by environment • Interactive authentication • Service-account use • Managed identity • Certificate authentication • Secret-store integration • Token handling • Session lifetime • Required modules • Troubleshooting • Security warnings Do not include active credentials or tenant-specific data.
Create a Permissions Matrix
To document least-privilege requirements per command.Create a least-privilege permissions matrix. For each exported command, document: • Resource accessed • Read or write operation • Required local rights • Required directory role • Required cloud role • Required API scope • Required filesystem access • Whether elevation is needed • Whether permission can be scoped Clearly mark permissions that require environment validation.
Create a Troubleshooting Guide
To build a task-oriented failure reference.Create a task-oriented troubleshooting guide based on the module's implementation, tests, and known errors. For each issue, include: • Symptom • Likely cause • Diagnostic command • Resolution • Security caution • When to escalate Do not invent error messages that the module does not emit.
Create a Compatibility Matrix
To distinguish tested from inferred platform support.Create a compatibility matrix covering: • Windows PowerShell 5.1 • Supported PowerShell 7 versions • Windows versions • Linux support • macOS support • Required .NET runtime • Module dependencies • Cloud versus on-premises support • Remoting requirements • Known incompatible environments Distinguish tested support from inferred compatibility.
Create Release Notes
When preparing a version for release.Generate release notes from the provided code changes, tests, issue references, and version history. Separate: • Added • Changed • Fixed • Deprecated • Removed • Security • Known issues Clearly identify breaking changes and required migration steps.
Validate Existing Documentation
When taking ownership of a module with existing docs.Compare the existing README, comment-based help, Markdown help, examples, and manifest with the current module code. List every discrepancy, including: • Incorrect parameter names • Missing parameters • Incorrect defaults • Invalid examples • Incorrect output descriptions • Unsupported compatibility claims • Missing exported commands • Deprecated commands still recommended • Incorrect permission requirements Rank discrepancies by operational impact.
Create a Documentation Build Pipeline
To automate documentation generation and validation in CI.Create a documentation build process using PowerShell and PlatyPS. Include: • Source-of-truth decision • Markdown generation • External-help generation • Schema validation • Link checking • Example testing • Command coverage checks • CI execution • Release artifact generation • Versioning • Publishing Provide scripts and pipeline examples appropriate for the repository.
Documentation Coverage Report
- Track help and example coverage per exported command
- Confirm private functions are excluded from public reference
- Prioritize documentation gaps before release
| Command | Exported | Comment Help | Markdown Help | Examples | Inputs | Outputs | Permissions |
|---|---|---|---|---|---|---|---|
| Get-ContosoComputerInventory | Yes | Complete | Complete | 4 | Complete | Complete | Complete |
| Export-ContosoComputerInventory | Yes | Partial | Missing | 1 | Partial | Missing | Missing |
| Invoke-ContosoInternalQuery | No | None | Not required | 0 | N/A | N/A | N/A |
Documentation Pester Tests
- Enforce documentation coverage in CI
- Fail builds on undocumented commands or parameters
- Validate common-parameter filtering across supported versions
Documentation coverage test suite
Documentation Build Script
- Regenerate Markdown and external help in one pass
- Enforce a documentation gate in the build
- Adapt the PlatyPS commands to the installed version
Documentation build script
Documentation Test Plan
- Verify help and example coverage per command
- Classify examples by how safely they can be executed
- Scan documentation for secrets and unsafe commands
Test documentation as an operational and security control:
Import Tests — verify
Help Tests — verify
Example Tests — classify examples as
Compatibility Tests — confirm
Security Tests — search documentation for
Link Tests — validate
Release Checklist
- Confirm every documentation artifact is complete before release
- Verify examples, help, and external help build cleanly
- Ensure no secrets ship and artifacts are signed where required
Before releasing a module:
Validation Checklist
- Accept or reject the AI's generated documentation
- Confirm every claim is validated against the code
- Verify no secrets or unverified compatibility claims remain
Before accepting generated documentation:
🔒 The full execution layer — every checklist, matrix, and the prompt pack — is included with ABME membership.
Unlock Full BlueprintFull Playbook
Overviewpublic
A PowerShell module may contain technically sound functions while remaining difficult to adopt, operate, and maintain because its documentation is incomplete, outdated, inconsistent, or scattered across source files.
Good module documentation should help several audiences:
- An administrator deciding whether the module fits a task
- A user learning how to run a command
- An automation engineer integrating the module into a larger workflow
- A maintainer troubleshooting behavior
- A reviewer assessing privileges, dependencies, and operational risk
- A support engineer diagnosing failures
- A security team evaluating how the module handles sensitive data
This workflow uses AI to inspect a PowerShell module and generate a complete, consistent documentation package. It covers module-level guidance, command reference documentation, examples, installation, configuration, permissions, dependencies, troubleshooting, security considerations, compatibility, and maintenance information.
The goal is documentation that allows a qualified user to install, understand, operate, troubleshoot, and maintain the module without reading every line of source code.
Business Problempublic
PowerShell module documentation is often incomplete because:
- Functions were written before documentation was planned.
- Comment-based help was copied between commands.
- Parameters changed without corresponding documentation updates.
- Examples demonstrate only the simplest success path.
- Installation requirements are undocumented.
- Required permissions are unclear.
- Output objects are not described.
- Errors and failure behavior are omitted.
- Module dependencies are not listed.
- Windows PowerShell and PowerShell 7 differences are not explained.
- Public and private commands are not distinguished.
- README files contain marketing language but limited operational detail.
- Documentation does not match the actual exported command surface.
- Release notes are missing.
- Help files cannot be generated or published consistently.
Poor documentation increases support workload and creates operational risk. Users may run commands with excessive privileges, misunderstand parameter behavior, rely on unstable output, or deploy the module in unsupported environments.
Typical Use Casespublic
Use this workflow when:
- Preparing a module for internal release
- Publishing a module to a private repository
- Publishing to the PowerShell Gallery
- Taking ownership of an inherited module
- Standardizing documentation across an IT team
- Preparing a module for customer delivery
- Creating comment-based help
- Generating Markdown help with PlatyPS
- Creating a README
- Documenting public commands
- Documenting configuration and deployment
- Preparing release notes
- Creating troubleshooting guidance
- Creating examples for administrators
- Documenting required privileges and API scopes
- Preparing a module for long-term maintenance
Do NOT Use This Workflow Whenpublic
This workflow is not intended to:
- Invent undocumented behavior
- Claim support for untested platforms
- Guarantee that examples are safe in production
- Replace code review
- Replace functional testing
- Replace security review
- Publish documentation without maintainer approval
- Expose secrets, internal endpoints, or customer information
- Describe private functions as supported public interfaces
- Treat generated documentation as correct without comparing it to the code
- Document planned features as though they already exist
Documentation must reflect the module's actual behavior.
Expected Outcomepublic
After completing this workflow, you should have:
- A module-purpose summary
- An exported-command inventory
- A public API map
- Complete comment-based help
- Parameter documentation
- Input and output documentation
- Usage examples
- Installation instructions
- Configuration guidance
- Dependency documentation
- Permission and authentication guidance
- Compatibility information
- Troubleshooting guidance
- Security considerations
- A README
- Command-reference pages
- Release-note recommendations
- Maintenance and contribution guidance
- Documentation validation results
🔒 The complete playbook — reference models, worked examples, and operational guidance — is included with ABME membership.
Unlock Full BlueprintDocumentation Packageprotected
A complete PowerShell module documentation package may include
- README.md
- Comment-based help in public functions
- Markdown command reference
- Module installation instructions
- Quick-start guide
- Configuration guide
- Authentication guide
- Permissions and roles guide
- Examples directory
- Troubleshooting guide
- Security considerations
- Compatibility matrix
- Changelog
- Contribution guide
- License information
- Support and issue-reporting guidance
- Migration notes
- Known limitations
- Architecture or design notes
- Generated external help files
Documentation Audiencesprotected
New User
- What the module does
- Whether it fits the task
- How to install it
- How to authenticate
- The first safe command to run
- Where to find examples
Experienced Administrator
- Command syntax
- Parameter behavior
- Output types
- Error behavior
- Pipeline support
- Permissions
- Performance and scale considerations
Automation Engineer
- Stable interfaces
- Output schemas
- Idempotency
- Exit and error behavior
- Logging
- Retry behavior
- Version compatibility
- Breaking-change policy
Security Reviewer
- Required privileges
- API scopes
- Credential handling
- Sensitive-data behavior
- Logging behavior
- External dependencies
- Remote endpoints
- Code-signing and integrity controls
Maintainer
- Module architecture
- Public versus private functions
- Build process
- Testing process
- Documentation generation
- Release process
- Versioning approach
- Contribution standards
Documentation Standardsprotected
Parameter Documentation Standards
For every parameter, document:
- Purpose
- Expected format
- Whether it is mandatory
- Default behavior
- Accepted values
- Validation
- Pipeline support
- Wildcard support
- Null and empty behavior
- Security implications
- Side effects
- Interaction with other parameters
Weak:
Specifies the name.Better:
Specifies the computer to query. The command accepts multiple names and
processes each independently. The parameter accepts pipeline input and
pipeline input by property name through ComputerName, CN, or Name.
Wildcards are not supported.Syntax Documentation
Syntax should reflect parameter sets accurately.
Example:
Get-ContosoRecord
-Id <String>
[-IncludeHistory]
[<CommonParameters>]
Get-ContosoRecord
-InputObject <Record>
[-IncludeHistory]
[<CommonParameters>]Do not merge distinct parameter sets into one misleading syntax block.
Validate syntax using:
Get-Command Get-ContosoRecord -SyntaxPipeline Documentation
Document both forms separately.
ValueFromPipeline
The entire incoming object binds to the parameter.
[Parameter(ValueFromPipeline)]
[string]$ComputerNameExample:
'SERVER01' |
Get-ContosoComputerInventoryValueFromPipelineByPropertyName
A property on the incoming object binds to the parameter.
[Parameter(ValueFromPipelineByPropertyName)]
[Alias('CN')]
[string]$ComputerNameExample:
[pscustomobject]@{
CN = 'SERVER01'
} |
Get-ContosoComputerInventoryDocumentation should name the accepted properties and aliases.
Output Documentation
Output documentation is often the weakest part of PowerShell help.
For each output object, document:
- Type name
- Whether one or many objects are returned
- Property names
- Property types
- Nullable properties
- Status values
- Sorting and order
- Error representation
- Whether output changes by parameter set
- Whether the command emits no object on success
- Whether status messages use separate streams
Example:
| Property | Type | Nullable | Description |
|---|---|---|---|
| ComputerName | String | No | Target computer |
| Status | String | No | Succeeded, Failed, or Skipped |
| Changed | Boolean | No | Indicates whether state changed |
| ErrorMessage | String | Yes | Sanitized failure detail |
Public output schemas should be treated as interfaces. Changing them may be a breaking change.
Side-Effect Documentation
State-changing commands should document:
- What resource changes
- Whether the operation is idempotent
- Whether ShouldProcess is supported
- Whether -WhatIf is supported
- Whether confirmation is requested
- Whether rollback exists
- Whether the operation can partially complete
- Whether rerunning is safe
- What permissions are required
- What logs are produced
Example note:
This command updates the Department attribute of each matched Active
Directory user. The command supports -WhatIf. A failure affecting one user
does not roll back updates completed for earlier users.Permissions Documentation
Avoid vague statements such as:
Administrative access may be required.Prefer:
The executing identity requires permission to read the specified Active
Directory users and write the Department attribute on the target objects.
Domain Admin membership is not required when the permission is delegated
to the applicable organizational unit.Where exact permissions cannot be confirmed, state:
The minimum required Microsoft Graph application permissions require
environment validation. The implementation currently calls the following
endpoints...Authentication Documentation
For each supported method, document:
- Intended environment
- Setup requirements
- Secret handling
- Session behavior
- Token lifetime
- Required modules
- Required permissions
- Recommended use
- Unsupported combinations
Example matrix:
| Method | Interactive | Unattended | Recommended Use |
|---|---|---|---|
| Current Windows identity | Yes | Yes | Domain-joined automation |
| Managed identity | No | Yes | Azure-hosted automation |
| Certificate application auth | No | Yes | Enterprise service automation |
| Client secret | No | Yes | Only when stronger methods are unavailable |
| Device code | Yes | No | Administrative interactive sessions |
Examples Standards
Good examples should:
- Solve a recognizable task
- Use safe placeholder values
- Explain the result
- Reflect actual parameter behavior
- Show structured output handling
- Demonstrate pipeline usage
- Demonstrate -WhatIf for changes
- Show error handling where useful
- Avoid active secrets
- Avoid internal infrastructure names
- Avoid overly simplistic values that hide real usage
Weak:
Get-ThingBetter:
$failedResults = Get-ContosoComputerInventory `
-ComputerName $serverNames |
Where-Object Status -eq 'Failed'
$failedResults |
Export-Csv `
-LiteralPath '.\failed-inventory.csv' `
-NoTypeInformationTroubleshooting Guide Structure
For every common problem, include:
Symptom — What the user observes.
Likely Cause — The most probable explanation.
Diagnostic Steps — Commands or checks that confirm the cause.
Resolution — A safe corrective action.
Security Note — Any warning about permissions, credentials, logging, or data exposure.
Escalation — What information to collect before requesting support.
Example:
Remote CIM Query Fails
Symptom: The command returns Status = Failed for one or more computers.
Likely causes:
- Computer is offline
- Name resolution failed
- CIM remoting is unavailable
- Firewall blocks the connection
- The executing identity lacks permission
Diagnostic steps:
Test-Connection `
-ComputerName 'SERVER01' `
-Count 1
Test-WSMan `
-ComputerName 'SERVER01'Security note: Do not solve the issue by broadly disabling the firewall or assigning unrestricted administrative access.
Known Limitations
Document limitations such as:
- No wildcard support
- No automatic retry
- No rollback
- Output order not guaranteed during parallel processing
- Maximum API page size
- Limited support for proxies
- No cross-platform support
- Windows-only dependencies
- Interactive authentication required
- One tenant per session
- Large datasets may require batching
- Certain error messages come from external services
- Formatting views require module import
Limitations should be factual and visible.
README Versus Command Reference
README
The README should help users:
- Understand the module
- Install it
- Run the first command
- Find detailed documentation
- Understand major requirements and limitations
It should not duplicate every command's full help.
Command Reference
The command reference should provide:
- Complete syntax
- Parameter details
- Inputs
- Outputs
- Examples
- Notes
- Related commands
Conceptual Guides
Conceptual guides should explain:
- Authentication
- Permissions
- Configuration
- Deployment
- Troubleshooting
- Security
- Migration
- Architecture
Separating these layers reduces duplication.
Compatibility Matrixprotected
Example matrix
- Distinguish: Supported
- Tested
- Expected to work
- Unsupported
- Unknown
Documentation Source of Truthprotected
Comment-Based Help as Source
- Advantages: Documentation stays near code; Get-Help works during development; easier for function maintainers
- Disadvantages: Markdown publishing may require generation; large help blocks make source files longer
Markdown as Source
- Advantages: Easier review and publishing; better for documentation sites; PlatyPS can generate external help
- Disadvantages: Code and docs may drift; developers must update separate files
Hybrid Approach
- Concise comment-based help in source
- Markdown command reference generated and maintained through PlatyPS
- CI validates exported-command coverage and metadata
Example Inputprotected
Module Manifest
@{
RootModule = 'ContosoInventory.psm1'
ModuleVersion = '1.2.0'
GUID = '8d06fb83-6721-4768-88f4-582bc3a70455'
Author = 'Contoso IT'
Description = 'Collects Windows computer inventory.'
PowerShellVersion = '5.1'
FunctionsToExport = @(
'Get-ContosoComputerInventory',
'Export-ContosoComputerInventory'
)
CmdletsToExport = @()
VariablesToExport = '*'
AliasesToExport = @()
}Public Function
function Get-ContosoComputerInventory {
[CmdletBinding()]
[OutputType([pscustomobject])]
param(
[Parameter(
Mandatory,
ValueFromPipeline,
ValueFromPipelineByPropertyName
)]
[Alias('CN', 'Name')]
[ValidateNotNullOrEmpty()]
[string[]]$ComputerName
)
process {
foreach ($computer in $ComputerName) {
try {
$operatingSystem = Get-CimInstance `
-ClassName Win32_OperatingSystem `
-ComputerName $computer `
-ErrorAction Stop
[pscustomobject]@{
ComputerName = $computer
OperatingSystem = $operatingSystem.Caption
Version = $operatingSystem.Version
Status = 'Succeeded'
ErrorMessage = $null
}
}
catch {
[pscustomobject]@{
ComputerName = $computer
OperatingSystem = $null
Version = $null
Status = 'Failed'
ErrorMessage = $_.Exception.Message
}
}
}
}
}Example Command Documentationprotected
Get-ContosoComputerInventory
Synopsis
Retrieves operating-system inventory from one or more Windows computers.
Description
Get-ContosoComputerInventory queries the Win32_OperatingSystem CIM class on each specified computer and returns one result object per computer.
The command does not terminate the entire operation when an individual computer cannot be queried. Instead, it returns a result object with a Status value of Failed and places the associated exception message in ErrorMessage.
The command requires network connectivity and permission to perform remote CIM queries on each target.
Syntax
Get-ContosoComputerInventory
[-ComputerName] <String[]>
[<CommonParameters>]Parameters
ComputerName
Specifies one or more computers to query.
The parameter:
- Is mandatory
- Accepts multiple values
- Accepts pipeline input
- Accepts pipeline input by property name
- Supports the aliases CN and Name
- Rejects null or empty values
Type: System.String[]
Required: True
Position: Named
Default value: None
Accept pipeline input: True
Accept wildcard characters: FalseInputs
System.String
You can pipe computer names to this command.
Objects containing a ComputerName, CN, or Name property may also bind by property name.
Outputs
System.Management.Automation.PSCustomObject
The command returns one object per computer with the following properties:
| Property | Type | Description |
|---|---|---|
| ComputerName | String | Target computer name |
| OperatingSystem | String or null | Operating-system caption |
| Version | String or null | Operating-system version |
| Status | String | Succeeded or Failed |
| ErrorMessage | String or null | Failure message when the query fails |
Example 1 — Query One Computer
Get-ContosoComputerInventory `
-ComputerName 'SERVER01'Queries SERVER01 and returns its operating-system inventory.
Example 2 — Query Multiple Computers
Get-ContosoComputerInventory `
-ComputerName 'SERVER01', 'SERVER02'Returns one result object for each named computer.
Example 3 — Use Pipeline Input
'SERVER01', 'SERVER02' |
Get-ContosoComputerInventoryPipes computer-name strings to the command.
Example 4 — Use Property-Name Binding
Import-Csv '.\computers.csv' |
Get-ContosoComputerInventoryThis example works when the CSV contains a column named ComputerName, CN, or Name.
Notes
- The command uses CIM remote access.
- The executing identity must have permission to query the target computer.
- Failed queries return failure objects rather than terminating the full pipeline.
- The ErrorMessage property may contain internal system details and should be handled appropriately before sharing reports externally.
- Wildcards are not implemented for ComputerName.
Related Links
- Export-ContosoComputerInventory
- Get-CimInstance
Example README Structureprotected
# ContosoInventory
ContosoInventory is a PowerShell module for collecting and exporting
Windows computer inventory through CIM.
## Features
- Query one or more Windows computers
- Accept pipeline input
- Return structured success and failure results
- Export inventory reports
- Support Windows PowerShell 5.1 and PowerShell 7 where tested
## Requirements
- Windows PowerShell 5.1 or a supported PowerShell 7 release
- Network access to target computers
- CIM remoting enabled
- Permission to query the target systems
## Installation
```powershell
Install-Module `
-Name ContosoInventory `
-Repository PSGallery `
-Scope CurrentUser
```
## Import
```powershell
Import-Module ContosoInventory
```
## Quick Start
```powershell
Get-ContosoComputerInventory `
-ComputerName 'SERVER01'
```
## Commands
| Command | Description |
| Get-ContosoComputerInventory | Retrieves computer inventory |
| Export-ContosoComputerInventory | Exports inventory results |
## Documentation
- Command reference
- Authentication and permissions
- Troubleshooting
- Known limitations
- Changelog
## Security
The module does not require stored credentials. It uses the caller's current authentication context unless otherwise documented.
## Support
Open an issue in the approved repository and include:
- Module version
- PowerShell version
- Operating system
- Sanitized error message
- Reproduction steps
The actual README should reflect the module's confirmed distribution and support model.Comment-Based Help Templateprotected
function Verb-Noun {
<#
.SYNOPSIS
Provides a concise one-sentence description.
.DESCRIPTION
Explains what the command does, how it behaves, and any important
operational constraints.
.PARAMETER Name
Describes the value, format, default behavior, and effect.
.EXAMPLE
Verb-Noun -Name 'Example'
Explains the result of the example.
.INPUTS
System.String
.OUTPUTS
Namespace.TypeName
.NOTES
Requires PowerShell 7.2 or later.
Requires permission to read the target resource.
.LINK
https://approved-documentation-location
#>
[CmdletBinding()]
param()
}Comment-based help should describe behavior, not duplicate syntax that PowerShell already generates.
PlatyPS Workflowprotected
Install PlatyPS:
Install-Module `
-Name Microsoft.PowerShell.PlatyPS `
-Scope CurrentUserImport the module being documented:
Import-Module `
-Name '.\ContosoInventory.psd1' `
-ForceCreate Markdown help:
New-MarkdownCommandHelp `
-ModuleInfo (
Get-Module ContosoInventory
) `
-OutputFolder '.\docs\commands'Update existing Markdown help:
Update-MarkdownCommandHelp `
-Path '.\docs\commands'Create external help:
New-ExternalHelp `
-Path '.\docs\commands' `
-OutputPath '.\en-US' `
-ForceExact commands may differ by PlatyPS version. The build pipeline should pin and test the documentation-tool version.
Documentation Validationprotected
Check Exported Command Coverage
$exportedCommands = Get-Command `
-Module 'ContosoInventory' `
-CommandType Function, Cmdlet
$helpFiles = Get-ChildItem `
-Path '.\docs\commands' `
-Filter '*.md'
$documentedNames = $helpFiles.BaseName
Compare-Object `
-ReferenceObject $exportedCommands.Name `
-DifferenceObject $documentedNamesCheck Help Availability
foreach ($command in $exportedCommands) {
$help = Get-Help -Name $command.Name -Full
[pscustomobject]@{
Command = $command.Name
SynopsisPresent = -not [string]::IsNullOrWhiteSpace(
$help.Synopsis
)
ExamplesPresent = @($help.Examples.Example).Count -gt 0
ParametersPresent = @($help.Parameters.Parameter).Count -gt 0
}
}Check Parameter Coverage
$command = Get-Command Get-ContosoComputerInventory
$help = Get-Help Get-ContosoComputerInventory -Full
$implementedParameters = $command.Parameters.Keys |
Where-Object {
$_ -notin [System.Management.Automation.PSCmdlet]::CommonParameters
}
$documentedParameters = @(
$help.Parameters.Parameter.Name
)
Compare-Object `
-ReferenceObject $implementedParameters `
-DifferenceObject $documentedParametersCommon and optional common parameters may require additional filtering.
Check Examples
Examples should be validated by:
- Parsing them
- Running safe examples
- Mocking external systems
- Confirming parameter names
- Confirming expected output
- Checking placeholder consistency
- Ensuring no secrets are present
Do not automatically execute state-changing documentation examples against production systems.
Manifest Documentation Reviewprotected
Review these fields:
@{
RootModule
ModuleVersion
GUID
Author
CompanyName
Copyright
Description
PowerShellVersion
CompatiblePSEditions
RequiredModules
RequiredAssemblies
ScriptsToProcess
TypesToProcess
FormatsToProcess
NestedModules
FunctionsToExport
CmdletsToExport
VariablesToExport
AliasesToExport
PrivateData
HelpInfoURI
}Avoid broad exports such as:
VariablesToExport = '*'unless intentionally required. Documentation review may reveal module-design issues that should be corrected separately.
Changelog and Versioningprotected
A changelog should help users determine whether an upgrade is safe.
Example:
# Changelog
## 1.3.0
### Added
- Added pipeline-by-property-name support to
`Get-ContosoComputerInventory`.
### Changed
- Improved failed-query result objects with a `Status` property.
### Fixed
- Corrected handling of computer names containing hyphens.
### Deprecated
- `Export-ContosoLegacyInventory` is deprecated and will be removed
in version 2.0.0.
### Security
- Removed plain-text credential parameters.
### Breaking Changes
- The `Result` property was renamed to `Status`.
### Migration
Replace:
```powershell
$result.Result
```
with:
```powershell
$result.Status
```Versioning Guidance
Document whether the module uses semantic versioning or another strategy. Under semantic versioning:
- Major: breaking public-interface changes
- Minor: backward-compatible functionality
- Patch: backward-compatible fixes
Potential breaking changes include: renaming commands, renaming parameters, removing aliases, changing output properties, changing output types, changing default behavior, changing authentication requirements, dropping a PowerShell version, changing error behavior, removing pipeline support. Documentation changes should ship with the code change they describe.
Migration Documentation
For each breaking change, include: (1) What changed, (2) Why it changed, (3) Affected versions, (4) Old syntax, (5) New syntax, (6) Output changes, (7) Behavior changes, (8) Required permission changes, (9) Required configuration changes, (10) Rollback considerations.
## Migrating from 1.x to 2.0
Version 2.0 removes the `-Credential` parameter. Unattended
automation must use managed identity or certificate-based authentication.
### Before
```powershell
Connect-ContosoService -Credential $credential
```
### After
```powershell
Connect-ContosoService -CertificateThumbprint $thumbprint
```Contribution Guide
A contribution guide may define: branching model, coding style, approved verbs, formatting rules, PSScriptAnalyzer configuration, Pester requirements, documentation requirements, example requirements, security review requirements, changelog requirements, pull-request process, review ownership, release process, breaking-change approval.
Every public command change must include corresponding updates to:
- Comment-based help
- Markdown command reference
- Examples
- Changelog
- Pester documentation coverage testsDocumentation Maintenance Modelprotected
Command Owner
- Function behavior
- Comment-based help
- Command examples
- Output schema documentation
Module Maintainer
- README
- Command index
- Compatibility
- Changelog
- Release notes
- Migration guidance
Security Reviewer
- Permission guidance
- Authentication guidance
- Security considerations
- Sensitive-data review
Documentation Pipeline Owner
- PlatyPS version
- Documentation build
- Coverage tests
- Link checks
- Publishing process
Security Considerationsprotected
Documentation itself can expose sensitive information.
Do not include:
- Real credentials
- API keys
- Access tokens
- Private keys
- Internal-only tenant IDs
- Customer names
- Private hostnames
- Sensitive IP addresses
- Confidential network paths
- Security-tool bypass instructions
- Unapproved endpoints
- Internal incident details
- Real personal data
- Full production error payloads
Use safe placeholders:
TENANT_ID
APPROVED_SERVER
SERVICE_ACCOUNT
CERTIFICATE_THUMBPRINT
https://api.example.invalidAlso avoid documenting insecure workarounds such as:
- Disabling certificate validation
- Broadly disabling firewalls
- Running every command as Domain Admin
- Storing credentials in source
- Suppressing all errors
- Trusting every repository
- Bypassing execution controls
Common Mistakesprotected
Documenting Intended Behavior Instead of Actual Behavior
A function may have been designed to support pipeline input but not actually declare the required parameter attributes.
Document the implementation, then record the design discrepancy.
Inventing Output Types
Do not assume a command returns a particular object because of its name.
Inspect the function and test the result.
Copying Parameter Text
Copied documentation often refers to the wrong command, default, or object.
Generate parameter text from the current implementation and review it individually.
Treating the README as Complete Documentation
A README should introduce the module, not replace detailed command and conceptual documentation.
Omitting Failure Behavior
Users need to know whether a command:
- Throws
- Returns a failure object
- Continues after per-object failures
- Retries
- Partially completes
- Rolls back
- Writes warnings
Omitting Permissions
Users may compensate by assigning excessive rights.
Document the smallest confirmed permission set.
Publishing Untested Examples
An incorrect example damages trust and may create operational risk.
Examples should be parsed and tested where safe.
Exposing Internal Details
Documentation should provide sufficient diagnostic detail without revealing confidential infrastructure or security-sensitive information.
Forgetting Output Stability
Users often automate against object properties.
Output changes should be treated and documented as interface changes.
Failing to Update Documentation with Code
Documentation drift begins when code and help are reviewed or released separately.
Include documentation in the same pull request.
Describing Inferred Compatibility as Tested
A module importing successfully does not prove all commands work on that platform.
Use precise compatibility language.
Automation Opportunitiesprotected
- Pull-request validation
- Module build pipelines
- GitHub Actions
- Azure DevOps pipelines
- Internal PowerShell repositories
- PowerShell Gallery release processes
- Documentation websites
- MSP script libraries
- Enterprise automation catalogs
- Code review standards
- Release-governance workflows
- A mature documentation gate could automatically detect: exported commands without help
- Parameters missing documentation
- Syntax changes
- Output-schema changes
- Invalid examples
- Missing changelog entries
- Broken links
- Unsupported compatibility claims
- Secrets in documentation
- Missing migration notes for breaking changes
Pro Tipsprotected
- Inventory the actual exported command surface before writing documentation.
- Use tests to verify examples and output descriptions.
- Document failure behavior as carefully as success behavior.
- Treat output properties as public interfaces.
- Keep the README task-oriented and move detailed reference material elsewhere.
- Separate command reference from authentication, permissions, and troubleshooting guides.
- Distinguish tested compatibility from inferred compatibility.
- Document the minimum required permission rather than recommending broad administrative roles.
- Use safe synthetic values in every example.
- Include -WhatIf examples for state-changing commands that support it.
- Validate parameter documentation against Get-Command.
- Validate help coverage in CI.
- Generate external help during the release process.
- Update documentation in the same pull request as code.
- Add migration guidance before releasing a breaking change.
- Assign ownership for ongoing documentation maintenance.
- Review documentation as an operational and security control, not merely a publishing task.
Related Blueprints
⚠ Normalization Warnings — 14 for review
- CLASSIFICATION TO CONFIRM: 'Prerequisites' classified as a checklist TOOL (gather-before-start items are completable). Alternative: body/prose.
- CLASSIFICATION TO CONFIRM: 'Testing Recommendations' classified as a checklist TOOL named 'Documentation Test Plan' (all six passes are verifiable/classifiable). Alternative: body/reference. Display name changed from source heading — confirm.
- RESTRUCTURE: 'Primary Prompt' and 'Follow-Up Prompts' (two source H1s) combined into one prompt_pack tool with 12 prompts; 'when' guidance lines are editorial additions, prompt text verbatim.
- RESTRUCTURE: 'Security Considerations' and 'Common Mistakes' kept as body sections (Common Mistakes as a GROUP given its many subsections) rather than playbook flat lists; playbook.security_considerations and playbook.common_mistakes intentionally empty.
- CLASSIFICATION TO CONFIRM: 'Module Documentation Inventory' classified as a template TOOL (copyable inventory command scaffold). Alternative: body/example. It contains reusable commands the practitioner runs against their own module.
- CLASSIFICATION TO CONFIRM: 'Documentation Coverage Report' classified as a matrix TOOL built from the doc's example table; the doc's coverage classifications (Complete/Partial/Missing/Not applicable/Requires validation) used as the rubric.
- CLASSIFICATION TO CONFIRM: 'Documentation Pester Tests', 'Example Documentation Build Script', and the release/validation checklists classified as TOOLS. The Pester test and build script are template tools (copyable scaffolds the practitioner adapts). 'Documentation Validation' code snippets kept as a body/example ('Documentation Validation') separate from the checklist tools.
- CLASSIFICATION TO CONFIRM: 'Documentation Package', 'Documentation Audiences', 'Compatibility Matrix', 'Documentation Source of Truth', and 'Documentation Maintenance Model' classified as body/reference (consulted taxonomies/models), not tools. The 'Authentication Documentation' and 'Compatibility Matrix' example tables are illustrative reference, not fill-in matrices — confirm the Compatibility Matrix is not intended as a fillable matrix tool.
- RESTRUCTURE: Numerous prose standards sections ('Parameter Documentation Standards','Syntax Documentation','Pipeline Documentation','Output Documentation','Side-Effect Documentation','Permissions Documentation','Authentication Documentation','Examples Standards','Troubleshooting Guide Structure','Known Limitations','README Versus Command Reference') grouped under a 'Documentation Standards' body/group to avoid a flat 40+ section list. 'Known Limitations' and 'README Versus Command Reference' placed in the group by theme — confirm placement.
- RESTRUCTURE: 'Changelog Structure', 'Versioning Guidance', 'Migration Documentation', and 'Contribution Guide' (source had these run together in one extracted block with embedded code fences) consolidated into a single body/example 'Changelog and Versioning'. Source extraction merged these headings; content preserved but boundaries reconstructed — confirm against original docx.
- EXTRACTION ARTIFACT: Multiple code blocks arrived as plain [P] paragraphs with collapsed whitespace and line breaks (backtick-continuation code). Whitespace/indentation reconstructed for readability in example HTML; verify code fidelity against the source docx, especially the inventory commands, PlatyPS workflow, and build script.
- MATRIX: 'Documentation Coverage Report' skeleton_rows set to 0 per empty-skeleton rule; example_rows are the doc's own sample rows verbatim.
- PS-010 has no Quick Wins or Roadmap sections; playbook.quick_wins and roadmap intentionally empty.
- stats.prompts set to 12 (1 primary + 11 follow-ups); stats.deliverables counted as 9 distinct tools.
SEO Block
- Title tag: Generate Complete PowerShell Module Docs | ABME (47 chars)
- Meta: Inventory a module's real command surface and generate a complete, verified documentation package — command reference, permissions, and examples that match the code. (165 chars)
- Schema: HowTo · noindex: false
- Related: ps-001, ps-002, ps-003, ps-004, ps-005, ps-006, ps-007, ps-008, ps-009
- Keywords: powershell module documentation, comment-based help, platyps markdown help, powershell command reference, powershell readme, powershell compatibility matrix, powershell permissions matrix, powershell help coverage tests, module manifest exports, powershell gallery documentation
