“PowerShell Private Gallery” – Your internal PowerShell Repository

Recently, the Microsoft PowerShell team published a new project in preview on GitHub:
“PowerShell Private Gallery” or “PSPrivateGallery”.


The idea is quite straight forward. Providing an internal (trusted) repository which provides access to your internal resources (scripts, modules, DSC resources, etc…) using the same SDII (Software Discovery, Installation and Inventory) mechanism provided by the PackageManagement and PowerShellGet modules.

For now, the project is called the “PowerShell Private Gallery”.


You can give this preview a try by following the instructions below.


  • Clone GitHub project locally (from https://github.com/PowerShell/PSPrivateGallery)


  • Extract the contents of the zip file into the path “C:\PSPrivateGallery”.

    Expand-Archive –Path “<MydownloadFolder>\PSPrivateGallery-master.zip” –DestinationPath “C:\” –Force # Requires PSv5
    Rename-Item –Path “C:\PSPrivateGallery-master\” –NewName “C:\PSPrivateGallery”

    NOTE: Unblock files (remove streams) using the Unblock-File cmdlet.

    dir –Path “C:\PSPrivateGallery” –Recurse | Unblock-File

  • Copy PSGallery DSC Resources to the $env:PSModulePath – Copy Modules folder contents to $env:ProgramFiles\WindowsPowerShell\Modules

    Copy-Item –Path “C:\PSPrivateGallery\Modules\*” –Destination “C:\Program Files\WindowsPowerShell\Modules” –Recurse

  • Generate Credential files for both user and admin

    Cd “C:\PSPrivateGallery\Configuration”
    Get-Credential –Credential GalleryUser  | Export-Clixml .\GalleryUserCredFile.clixml
    Get-Credential –Credential GalleryAdmin | Export-Clixml .\GalleryAdminCredFile.clixml

    IMPORTANT: These passwords must meet password complexity requirements for machine/domain.

  • Update Configuration Data to your needs (Optional)
    • \Configuration\PSPrivateGalleryEnvironment.psd1
    • \Configuration\PSPrivateGalleryPublishEnvironment.psd1
  • Deploy the PowerShell Gallery, using PSPrivateGallery.ps1

    Cd “C:\PSPrivateGallery\Configuration”


  • Once completed, the Private PowerShell Gallery is available on http://localhost:8080.


  • By default, it is a clean and empty repository.


  • Populate the local instance of the Gallery with specified PowerShell modules, using PSPrivateGalleryPublish.ps1.

    Cd “C:\PSPrivateGallery\Configuration”


  • Once completed, the Private PowerShell Gallery shows 3 modules imported from the Public PowerShell Gallery (PSScriptAnalyzer, ARTools and Authenticode).


  • Register the Private PSGallery as an internal PowerShell repository, using Register-PSRepository.

    Register-PSRepository –Name PSPrivateGallery –SourceLocation “http://localhost:8080/api/v2” –InstallationPolicy Trusted –PackageManagementProvider NuGet


  • Verify the PowerShell repository as internal source, using Get-PSRepository.



  • Discovery, Installation and Inventory of module using the internal/private PowerShell repository

    Find-Module –Name PSScriptAnalyzer
    Install-Module –Name PSScriptAnalyzer
    Get-Module –Name PSScriptAnalyzer


    Hope this helps…

    Kurt Roggen [BE]

  • Advertisement

    3 thoughts on ““PowerShell Private Gallery” – Your internal PowerShell Repository

    1. Great article. Simplest walk through I’ve found.
      I’d like to know what your experience has been so far using this? Stable and low maintenance? Might be a better way to share internal powershell modules created but wanted your real world experience on it.


    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out /  Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out /  Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out /  Change )

    Connecting to %s