Desired State Configuration Resources for PackageManagement Providers

PowerShell Team


You may have heard of, or even already used PackageManagement (aka OneGet). Recently, I was reading the OneGet blog and OneGet in GitHub, and decided to give it a try by installing the Windows Management Framework (WMF) 5.0 Preview April 2015. I found that PackageManagement provides a consistent user experience by exposing the same set of PowerShell Cmdlets for different flavors of software installation technologies, such as PowerShell modules, NuGet packages, MSI, MSU, etc. It’s indeed a unified package management framework. So I decided to write some Desired State Configuration (DSC) resources for some of the PackageManagement providers, which will hopefully make your life even easier.


Windows Management Framework (WMF) 5.0 Preview April 2015


As PackageManagement is a work-in-progress, I have started with the following two providers, since they are pretty stable already: PSModule and NuGet. I named the DSC module as PackageManagementProviderResource, containing the following DSC resources:

  • PSModule is a DSC Resource that corresponds to the PSModule PackageManagement provider for managing PowerShell modules. It fetches modules from the PowerShell Gallery repository.
  • NuGetPackage is a DSC resource that corresponds to the NuGet PackageManagement provider for managing packages from NuGet repositories.
  • PackageManagementSource is a DSC Resource that lets you register or unregister a package source on your computer.

The source code for these DSC resources is available on the PowerShell Github. It’s also downloadable from the PowerShell Gallery using PowerShellGet (included in WMF 5.0 Preview):

Install-Module -Repository PSGallery PackageManagementProviderResource


Sample 1 – Install a JQuery package from the NuGet source location

In this DSC configuration, I used the PackageManagementSource and NuGetPackage DSC resources to install JQuery 2.0.1 from


Sample 2 – Install a PowerShell Module, ‘xJea’ from the PowerShell gallery

You may have noticed, unlike the above sample, that there is no package resource registration here. That is because the ‘PSGallery’ was already registered when WMF 5.0 preview was installed. You can always run the Get-PackageSource cmdlet to find out what package sources have already been registered on your system.



Hope you enjoy trying it out.


Jianyun Tao

PowerShell Team


Discussion is closed.

Feedback usabilla icon