PowerShell / PowerShellGallery

219 stars 59 forks source link

install-module AzureAD failed to install error:PSModule.psm1:1809 char:21 #263

Open eburnett838 opened 8 months ago

eburnett838 commented 8 months ago

Prerequisites

Steps to reproduce

I am unable to install AzureAD module I have tried

I found thins and tried it to see and got same error. PS C:\Scripts> Install-PackageProvider -Name NuGet -Force -MinimumVersion 2.8.5.201 -Verbose VERBOSE: Using the provider 'Bootstrap' for searching packages. VERBOSE: Finding the package 'Bootstrap::FindPackage' 'NuGet','','2.8.5.201','''. VERBOSE: Performing the operation "Install Package" on target "Package 'nuget' version '2.8.5.208' from 'https://onegetcdn.azureedge.net/providers/nuget-2.8.5.208.package.swidtag'.". VERBOSE: Installing the package 'https://onegetcdn.azureedge.net/providers/nuget-2.8.5.208.package.swidtag'. VERBOSE: Installed the package 'nuget' to 'C:\Program Files\PackageManagement\ProviderAssemblies\nuget\2.8.5.208\Microsoft.PackageManagement.NuGetProvider.dll'. VERBOSE: Skipping previously processed assembly: C:\Program Files\PackageManagement\ProviderAssemblies\nuget\2.8.5.208\Microsoft.PackageManagement.NuGetProvider.dll.

Name Version Source Summary


nuget 2.8.5.208 https://onege... NuGet provider for the OneGet meta-package manager VERBOSE: Importing the package provider NuGet VERBOSE: The provider 'NuGet' has already been imported. Trying to import it again. VERBOSE: Loading an assembly 'C:\Program Files\PackageManagement\ProviderAssemblies\nuget\2.8.5.208\Microsoft.PackageManagement.NuGetProvider.dll'. VERBOSE: Imported provider 'C:\Program Files\PackageManagement\ProviderAssemblies\nuget\2.8.5.208\Microsoft.PackageManagement.NuGetProvider.dll' .

PS C:\Scripts> Install-Module -Name PowerShellGet -Force -Verbose VERBOSE: Using the provider 'PowerShellGet' for searching packages. VERBOSE: The -Repository parameter was not specified. PowerShellGet will use all of the registered repositories. VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'. VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2' and PackageManagementProvider is 'NuGet'. VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'' for ''. VERBOSE: Total package yield:'1' for the specified package 'PowerShellGet'. VERBOSE: Performing the operation "Install-Module" on target "Version '2.2.5' of module 'PowerShellGet'". VERBOSE: The installation scope is specified to be 'AllUsers'. VERBOSE: The specified module will be installed in 'C:\Program Files\WindowsPowerShell\Modules'. VERBOSE: The specified Location is 'NuGet' and PackageManagementProvider is 'NuGet'. VERBOSE: Downloading module 'PowerShellGet' with version '2.2.5' from the repository 'https://www.powershellgallery.com/api/v2'. VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'' for ''. VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PackageManagement'' for ''. VERBOSE: InstallPackage' - name='PackageManagement', version='1.4.8.1',destination='C:\Users\xxxxxx\AppData\Local\Temp\95143681' VERBOSE: DownloadPackage' - name='PackageManagement', version='1.4.8.1',destination='C:\Users\xxxxxx\AppData\Local\Temp\95143681\PackageManagement\PackageManagement.nupkg', uri='https://www.powershellgallery.com/api/v2/package/PackageManagement/1.4.8.1' VERBOSE: Downloading 'https://www.powershellgallery.com/api/v2/package/PackageManagement/1.4.8.1'. VERBOSE: Completed downloading 'https://www.powershellgallery.com/api/v2/package/PackageManagement/1.4.8.1'. VERBOSE: Completed downloading 'PackageManagement'. VERBOSE: Hash for package 'PackageManagement' does not match hash provided from the server. VERBOSE: InstallPackageLocal' - name='PackageManagement', version='1.4.8.1',destination='C:\Users\xxxxxx\AppData\Local\Temp\95143681' VERBOSE: InstallPackage' - name='PowerShellGet', version='2.2.5',destination='C:\Users\xxxxxx\AppData\Local\Temp\95143681' VERBOSE: DownloadPackage' - name='PowerShellGet', version='2.2.5',destination='C:\Users\xxxxxx\AppData\Local\Temp\95143681\PowerShellGet\PowerShellGet.nupkg', uri='https://www.powershellgallery.com/api/v2/package/PowerShellGet/2.2.5' VERBOSE: Downloading 'https://www.powershellgallery.com/api/v2/package/PowerShellGet/2.2.5'. VERBOSE: Completed downloading 'https://www.powershellgallery.com/api/v2/package/PowerShellGet/2.2.5'. VERBOSE: Completed downloading 'PowerShellGet'. VERBOSE: Hash for package 'PowerShellGet' does not match hash provided from the server. VERBOSE: InstallPackageLocal' - name='PowerShellGet', version='2.2.5',destination='C:\Users\xxxxxx\AppData\Local\Temp\95143681' VERBOSE: Catalog file 'PackageManagement.cat' is not found in the contents of the module 'PackageManagement' being installed. VERBOSE: Valid authenticode signature found in the file 'PackageManagement.psd1' for the module 'PackageManagement'. VERBOSE: For publisher validation, current module 'PackageManagement' with version '1.4.8.1' with publisher name 'CN=Microsoft Root Certificate Authority 2011, O=Microsoft Corporation, L=Redmond, S=Washington, C=US'. Is this module signed by Microsoft: 'True'. VERBOSE: For publisher validation, using the previously-installed module 'PackageManagement' with version '1.0.0.1' under 'C:\Program Files (x86)\WindowsPowerShell\Modules\PackageManagement\1.0.0.1' with publisher name 'CN=Microsoft Root Certificate Authority 2010, O=Microsoft Corporation, L=Redmond, S=Washington, C=US'. Is this module signed by Microsoft: 'True'. VERBOSE: Publisher 'CN=Microsoft Root Certificate Authority 2011, O=Microsoft Corporation, L=Redmond, S=Washington, C=US' of the new module 'PackageManagement' with version '1.4.8.1' matches with the publisher 'CN=Microsoft Root Certificate Authority 2010, O=Microsoft Corporation, L=Redmond, S=Washington, C=US' of the previously-installed module 'PackageManagement' with version '1.0.0.1'. Both versions are signed with a Microsoft root certificate. PackageManagement\Install-Package : The following commands are already available on this system:'Find-Package,Install-Package,Uninstall-Package'. This module 'PackageManagement' may override the existing commands. If you still want to install this module 'PackageManagement', use -AllowClobber parameter. At C:\Program Files (x86)\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 char:21 + ... $null = PackageManagement\Install-Package @PSBoundParameters + ~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception + FullyQualifiedErrorId : CommandAlreadyAvailable,Validate-ModuleCommandAlreadyAvailable,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

PS C:\Scripts> Install-Module -Name PowerShellGet -Force -Verbose -AllowClobber VERBOSE: Using the provider 'PowerShellGet' for searching packages. VERBOSE: The -Repository parameter was not specified. PowerShellGet will use all of the registered repositories. VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'. VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2' and PackageManagementProvider is 'NuGet'. VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'' for ''. VERBOSE: Total package yield:'1' for the specified package 'PowerShellGet'. VERBOSE: Performing the operation "Install-Module" on target "Version '2.2.5' of module 'PowerShellGet'". VERBOSE: The installation scope is specified to be 'AllUsers'. VERBOSE: The specified module will be installed in 'C:\Program Files\WindowsPowerShell\Modules'. VERBOSE: The specified Location is 'NuGet' and PackageManagementProvider is 'NuGet'. VERBOSE: Downloading module 'PowerShellGet' with version '2.2.5' from the repository 'https://www.powershellgallery.com/api/v2'. VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'' for ''. VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PackageManagement'' for ''. VERBOSE: InstallPackage' - name='PackageManagement', version='1.4.8.1',destination='C:\Users\xxxxxx\AppData\Local\Temp\688306815' VERBOSE: DownloadPackage' - name='PackageManagement', version='1.4.8.1',destination='C:\Users\xxxxxx\AppData\Local\Temp\688306815\PackageManagement\PackageManagement.nupkg', uri='https://www.powershellgallery.com/api/v2/package/PackageManagement/1.4.8.1' VERBOSE: Downloading 'https://www.powershellgallery.com/api/v2/package/PackageManagement/1.4.8.1'. VERBOSE: Completed downloading 'https://www.powershellgallery.com/api/v2/package/PackageManagement/1.4.8.1'. VERBOSE: Completed downloading 'PackageManagement'. VERBOSE: Hash for package 'PackageManagement' does not match hash provided from the server. VERBOSE: InstallPackageLocal' - name='PackageManagement', version='1.4.8.1',destination='C:\Users\xxxxxx\AppData\Local\Temp\688306815' VERBOSE: InstallPackage' - name='PowerShellGet', version='2.2.5',destination='C:\Users\xxxxx\AppData\Local\Temp\688306815' VERBOSE: DownloadPackage' - name='PowerShellGet', version='2.2.5',destination='C:\Users\xxxxxx\AppData\Local\Temp\688306815\PowerShellGet\PowerShellGet.nupkg', uri='https://www.powershellgallery.com/api/v2/package/PowerShellGet/2.2.5' VERBOSE: Downloading 'https://www.powershellgallery.com/api/v2/package/PowerShellGet/2.2.5'. VERBOSE: Completed downloading 'https://www.powershellgallery.com/api/v2/package/PowerShellGet/2.2.5'. VERBOSE: Completed downloading 'PowerShellGet'. VERBOSE: Hash for package 'PowerShellGet' does not match hash provided from the server. VERBOSE: InstallPackageLocal' - name='PowerShellGet', version='2.2.5',destination='C:\Users\xxxxxx\AppData\Local\Temp\688306815' VERBOSE: Catalog file 'PackageManagement.cat' is not found in the contents of the module 'PackageManagement' being installed. VERBOSE: Valid authenticode signature found in the file 'PackageManagement.psd1' for the module 'PackageManagement'. VERBOSE: For publisher validation, current module 'PackageManagement' with version '1.4.8.1' with publisher name 'CN=Microsoft Root Certificate Authority 2011, O=Microsoft Corporation, L=Redmond, S=Washington, C=US'. Is this module signed by Microsoft: 'True'. VERBOSE: For publisher validation, using the previously-installed module 'PackageManagement' with version '1.0.0.1' under 'C:\Program Files (x86)\WindowsPowerShell\Modules\PackageManagement\1.0.0.1' with publisher name 'CN=Microsoft Root Certificate Authority 2010, O=Microsoft Corporation, L=Redmond, S=Washington, C=US'. Is this module signed by Microsoft: 'True'. VERBOSE: Publisher 'CN=Microsoft Root Certificate Authority 2011, O=Microsoft Corporation, L=Redmond, S=Washington, C=US' of the new module 'PackageManagement' with version '1.4.8.1' matches with the publisher 'CN=Microsoft Root Certificate Authority 2010, O=Microsoft Corporation, L=Redmond, S=Washington, C=US' of the previously-installed module 'PackageManagement' with version '1.0.0.1'. Both versions are signed with a Microsoft root certificate. VERBOSE: Installing the dependency module 'PackageManagement' with version '1.4.8.1' for the module 'PowerShellGet'. VERBOSE: Module 'PackageManagement' was installed successfully to path 'C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.4.8.1'. VERBOSE: Catalog file 'PowerShellGet.cat' is not found in the contents of the module 'PowerShellGet' being installed. VERBOSE: Valid authenticode signature found in the file 'PowerShellGet.psd1' for the module 'PowerShellGet'. VERBOSE: For publisher validation, current module 'PowerShellGet' with version '2.2.5' with publisher name 'CN=Microsoft Root Certificate Authority 2011, O=Microsoft Corporation, L=Redmond, S=Washington, C=US'. Is this module signed by Microsoft: 'True'. VERBOSE: For publisher validation, using the previously-installed module 'PowerShellGet' with version '1.0.0.1' under 'C:\Program Files (x86)\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1' with publisher name 'CN=Microsoft Root Certificate Authority 2010, O=Microsoft Corporation, L=Redmond, S=Washington, C=US'. Is this module signed by Microsoft: 'True'. VERBOSE: Publisher 'CN=Microsoft Root Certificate Authority 2011, O=Microsoft Corporation, L=Redmond, S=Washington, C=US' of the new module 'PowerShellGet' with version '2.2.5' matches with the publisher 'CN=Microsoft Root Certificate Authority 2010, O=Microsoft Corporation, L=Redmond, S=Washington, C=US' of the previously-installed module 'PowerShellGet' with version '1.0.0.1'. Both versions are signed with a Microsoft root certificate. VERBOSE: Module 'PowerShellGet' was installed successfully to path 'C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5'.

PS C:\Scripts> Update-Module

Expected behavior

PS C:\Scripts> install-module AzureAD -Force -Verbose
VERBOSE: Module 'AzureAD' was installed successfully

Actual behavior

PS C:\Scripts> install-module AzureAD -Force -Verbose
VERBOSE: Using the provider 'PowerShellGet' for searching packages.
VERBOSE: The -Repository parameter was not specified.  PowerShellGet will use all of the registered repositories.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2' and PackageManagementProvider is 'NuGet'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='AzureAD'' for ''.
VERBOSE: Total package yield:'1' for the specified package 'AzureAD'.
VERBOSE: Performing the operation "Install-Module" on target "Version '2.0.2.182' of module 'AzureAD'".
VERBOSE: The installation scope is specified to be 'AllUsers'.
VERBOSE: The specified module will be installed in 'C:\Program Files\WindowsPowerShell\Modules'.
VERBOSE: The specified Location is 'NuGet' and PackageManagementProvider is 'NuGet'.
VERBOSE: Downloading module 'AzureAD' with version '2.0.2.182' from the repository 'https://www.powershellgallery.com/api/v2'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='AzureAD'' for ''.
VERBOSE: InstallPackage' - name='AzureAD', version='2.0.2.182',destination='C:\Users\xxxxxx\AppData\Local\Temp\2124897737'
VERBOSE: DownloadPackage' - name='AzureAD', version='2.0.2.182',destination='C:\Users\xxxxxx\AppData\Local\Temp\2124897737\AzureAD\AzureAD.nupkg', uri='https://www.powershellgallery.com/api/v2/package/AzureAD/2.0.2.182'
VERBOSE: Downloading 'https://www.powershellgallery.com/api/v2/package/AzureAD/2.0.2.182'.
VERBOSE: Completed downloading 'https://www.powershellgallery.com/api/v2/package/AzureAD/2.0.2.182'.
VERBOSE: Completed downloading 'AzureAD'.
VERBOSE: Hash for package 'AzureAD' does not match hash provided from the server.
VERBOSE: InstallPackageLocal' - name='AzureAD', version='2.0.2.182',destination='C:\Users\xxxxx\AppData\Local\Temp\2124897737'
PackageManagement\Install-Package : Package 'AzureAD' failed to be installed because: End of Central Directory record could not be found.
At C:\Program Files (x86)\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidResult: (AzureAD:String) [Install-Package], Exception
    + FullyQualifiedErrorId : Package '{0}' failed to be installed because: {1},Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Error details

No response

Environment data

PS C:\Scripts> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.3570
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.3570
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version

5.1

Visuals

No response

o-l-a-v commented 3 months ago

Try using PowerShellGet and PackageManagement successor PSResourceGet instead?