Closed vyckou closed 7 years ago
Appears it does work, only you need to include Local PSGallery source DSC before specifying DSC for module.
Added following configuration
PackageManagementSource LocalPSGallery
{
Ensure = "Present"
Name = "LocalPSgallery"
ProviderName= "PowerShellGet"
SourceUri = "http://artifactory.xxxxxx.net/artifactory/api/nuget/db-nuget-windows_PSGallery"
InstallationPolicy ="Trusted"
}
before
PSModule MyPSModule
{
Ensure = "present"
Name = $Name
RequiredVersion = "1.0.0.0"
Repository = "LocalPSGallery"
InstallationPolicy="trusted"
}
and it works like a charm
@vyckou , PackageManagementSource registers package source to your local repo. I'm glad it worked out for you.
Are there any chances to specify somewhere/somehow global package repo? That everyone could use this repo, whoever logons to the server/workstation? As with the current DSC PackageManagementSource works only for the System context, where LCM is being executed.
No. It's per user. The design is mainly for security concerns.
I have managed to solve that, by adding/modifying register-packagesource command into C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1 which is executed on every single run of the powerhshell. Can be easy achieved by DSC, only using not this resource, but custom- changing file contentes ;)
I see. it's not convenient. Any reasons you need everyone to access the repo?
I recommend you open issue for supporting AllUser in github.com/PowerShell/PowerShellGet.
I can successfully find my module "update-module" using find-module 'update-module' I can download and install it using install-module 'update-module' -Repository 'LocalPSGallery'
But DSC fails with the errors: **Unable to find package source 'LocalPSGallery'. Use Get-PackageSource to see all available package sources.
VERBOSE: [WE0031]: [[PSModule]MyPSModule] Source '' not found. Please make sure you register it. VERBOSE: [WE0031]: [[PSModule]MyPSModule] Begin invoking find-module 'update-module' **Unable to find repository 'LocalPSGallery'. Use Get-PSRepository to see all available repositories.