I have servers which have no access to the Internet so I have an internal PSRepository. I've downloaded the current SqlServer module (21.1.18256) and published it to my internal repo. I've installed it on five servers. On the sixth, I get:
> Install-module -name SqlServer -Repository JLP -AllowClobber
PackageManagement\Install-Package : Access is denied
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1772 char:21
+ ... $null = PackageManagement\Install-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exce
ption
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.GetChildItemCommand,Mic
rosoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
I've never seen this before and have no idea where to start.
I'm running PowerShell (5.1) as admin. Versions are:
> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.14393.4583
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.4583
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
UPDATE
I had older versions on my repo: 21.1.18121 and 21.0.17199. I tried installing and got the Access is Denied message. Then I tried 21.0.17199 using
Install-module -name SqlServer -Repository JLP -AllowClobber -RequiredVersion 21.0.17199
and it worked.
UPDATE 2
I have downloaded other versions to my repo and tried them.
21.0.17279 failed to install.
21.0.17262 failed to install.
21.0.17240 installed.