PSDepend logo

PSDepend

A PowerShell dependency handler. Declare your dependencies in a .psd1 file and let Invoke-PSDepend resolve, install, import, and test them.

PowerShell 7+
Install-PSResource PSDepend
PowerShell 5.1
Install-Module PSDepend

Declarative DependencyFiles

Declare every Dependency in a simple .psd1 file. Invoke-PSDepend finds your *.depend.psd1 and requirements.psd1 files automatically — think pip install -r or bundle install for PowerShell.

Pluggable DependencyTypes

Each Dependency picks a DependencyType — PSGalleryModule, Git, Chocolatey, FileDownload and more — that selects the DependencyScript handling it. Register your own to extend PSDepend.

Install, Test, or Import

Run a DependencyFile with any combination of the Install, Test, and Import PSDependActions — verify an environment in CI, or hydrate one from scratch.

Tag-based selection

Tag your Dependencies and pass -Tags to Invoke-PSDepend to resolve just the subset you need for a given task or pipeline stage.

Ordered Prerequisites

Express ordering constraints between Dependencies with DependsOn. PSDepend resolves them into topological order before anything is installed.

Flexible Target

Send a Dependency to a scope (CurrentUser, AllUsers) or any filesystem path via Target. The DependencyScript branches on whichever you give it.

Declare your dependencies

Store your Dependencies in a PowerShell data file named *.depend.psd1 or requirements.psd1. The simplest form maps a module name to a version:

requirements.psd1
@{
    psake        = 'latest'
    Pester       = 'latest'
    BuildHelpers = '0.0.20'
    PSDeploy     = '0.1.21'
}

Then resolve everything in one call:

PowerShell
Import-Module PSDepend
Invoke-PSDepend -Path .\requirements.psd1

Need more control? Expand any entry into a full Dependency to set its DependencyType, Target, Tags, or DependsOn ordering — and add a PSDependOptions block to apply defaults across the whole DependencyFile.

Commands

The commands you'll reach for most.

Invoke-PSDepend

The main entry point. Resolves a DependencyFile and installs, tests, and/or imports its Dependencies.

Get-Dependency

Parse a DependencyFile into typed Dependency objects without acting on them — handy for inspection and debugging.

Get-PSDependType

List the registered DependencyTypes and the DependencyScript each one maps to.

Get-PSDependScript

Resolve the DependencyScript that will handle a given DependencyType.

Install-Dependency

Run only the Install PSDependAction for a Dependency.

Test-Dependency

Run only the Test PSDependAction to check whether a Dependency is already satisfied.