PowerShell repositories
Each of the examples from the previous section uses the PowerShell Gallery as a source for installing modules. This is an important resource, but in a business setting, it may be desirable to restrict access to the gallery. Instead, an internal repository that holds curated or internally developed content may be implemented to share content.
Creating an SMB repository
An SMB file share is a simple way to share PowerShell content. A file share may be registered as a repository as follows:
$params = @{
Name = 'Internal'
SourceLocation = '\\server\share\directory'
InstallationPolicy = 'Trusted'
}
Register-PSRepository @params
Existing modules can be published to the repository using the Publish-Module
command. For example, if the module Pester 5.0.2 is installed, it may be published to the newly created internal repository:
$params = @{
Name = 'pester'
...