A PowerShell 5+ module designed to manage inventory operations, built following Microsoft's PowerShell best practices and guidelines.
- PowerShell 5.1+ Compatible: Works with PowerShell 5.1 and later versions
- Standards Compliant: Follows Microsoft's PowerShell best practices
- Quality Assured: All code passes PSScriptAnalyzer validation
- Comprehensive Testing: Full Pester test coverage
- Automated CI/CD: GitHub Actions for validation and publishing
Install-Module -Name MetaNull.InventoryCli -Repository PSGallery- Clone the repository:
git clone https://github.com/metanull/inventory-cli.git
cd inventory-cli- Build the module:
cd src/MetaNull.InventoryCli
.\Build.ps1- Import the built module:
Import-Module .\build\MetaNull.InventoryCli\<version>\MetaNull.InventoryCli.psd1After installation, you can use the module's functions:
# Import the module
Import-Module MetaNull.InventoryCli
# List available commands
Get-Command -Module MetaNull.InventoryCli
# Get help for specific functions
Get-Help Get-Dummy -FullThis module is built using MetaNull.ModuleMaker, which provides a standardized structure and build process for PowerShell modules.
- PowerShell 5.1 or later
- MetaNull.ModuleMaker
- PSScriptAnalyzer
- Pester (v5.5.0)
src/MetaNull.InventoryCli/
├── Blueprint.psd1 # Module build configuration
├── Build.ps1 # Build script with version management
├── Publish.ps1 # Publishing script for PSGallery
├── Version.psd1 # Version tracking file
├── source/ # Source code directory
│ ├── init/ # Module initialization scripts
│ ├── private/ # Private functions (not exported)
│ ├── public/ # Public functions (exported)
│ └── class/ # PowerShell classes (if any)
├── test/ # Test directory structure
│ ├── private/ # Tests for private functions
│ └── public/ # Tests for public functions
└── build/ # Build output directory (generated)
- Install MetaNull.ModuleMaker:
Install-Module -Name MetaNull.ModuleMaker- Create a new function:
New-FunctionBlueprint -ModulePath "src/MetaNull.InventoryCli" -FunctionName "Get-InventoryItem" -Visibility Public- Implement the function in the generated file
- Write comprehensive Pester tests
- Run validation and build:
# Run PSScriptAnalyzer
Invoke-ScriptAnalyzer -ExcludeRule PSAvoidUsingConvertToSecureStringWithPlainText -Path "src" -Recurse
# Run tests
Invoke-Pester -Path "src/MetaNull.InventoryCli/test"
# Build the module
.\src\MetaNull.InventoryCli\Build.ps1- PSScriptAnalyzer: All code must pass without errors or warnings
- Approved Verbs: Function names must use Microsoft's approved PowerShell verbs
- CmdletBinding: All functions must include
[CmdletBinding()] - OutputType: Functions should specify
[OutputType()] - Help Documentation: Comprehensive comment-based help required
Run all tests:
cd src/MetaNull.InventoryCli
Invoke-Pester -Path "test" -CodeCoverage "source/**/*.ps1"cd src/MetaNull.InventoryCli
# Build with default increment (build number)
.\Build.ps1
# Build with specific version increment
.\Build.ps1 -IncrementMinor
.\Build.ps1 -IncrementMajor
.\Build.ps1 -IncrementRevision# Get your API key from https://www.powershellgallery.com/account/apikeys
$ApiKey = Read-Host -AsSecureString "Enter PSGallery API Key"
$Credential = New-Object PSCredential("apikey", $ApiKey)
# Publish using the provided script
.\Publish.ps1 -Credential $Credential- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature-name - Make your changes following the development guidelines
- Ensure all tests pass and code quality checks succeed
- Commit your changes:
git commit -am 'Add your feature' - Push to the branch:
git push origin feature/your-feature-name - Create a Pull Request
- All code must pass PSScriptAnalyzer validation
- All tests must pass
- New functions must have corresponding tests
- Follow PowerShell best practices and naming conventions
- Include comprehensive help documentation
This repository uses GitHub Actions for continuous integration and deployment:
- PR Validation: Automatically runs PSScriptAnalyzer and Pester tests on pull requests
- Automated Publishing: Publishes to PSGallery on push to main branch or manual trigger
For automated publishing, configure the following secret in your GitHub repository:
PSGALLERY_API_KEY: Your PowerShell Gallery API key
Versions are automatically managed by the build script using semantic versioning:
- Major: Breaking changes (
Build.ps1 -IncrementMajor) - Minor: New features, backward compatible (
Build.ps1 -IncrementMinor) - Build: Automatic increment on each build
- Revision: Bug fixes (
Build.ps1 -IncrementRevision)
This project is licensed under the terms specified in the LICENSE file.
Pascal Havelange
- GitHub: @metanull
- Project: inventory-cli
If you encounter any issues or have questions:
- Check the existing issues
- Create a new issue with detailed information
- Follow the issue template if provided
See releases for version history and changes.