PowerShell / PSResourceGet

PSResourceGet is the package manager for PowerShell
https://www.powershellgallery.com/packages/Microsoft.PowerShell.PSResourceGet
MIT License
489 stars 94 forks source link

Version 3.0.17 breaks Connect-ExchangeOnline (ExchangeOnlineManagement) #876

Closed robinmalik closed 1 year ago

robinmalik commented 1 year ago

Prerequisites

Steps to reproduce

When installing PowerShellGet v3, specifically 3.0.17-beta17 Connect-ExchangeOnline breaks under PowerShell 5.1 with the following error visible in the shell ($Error[0]):

Update-ModuleManifest : A parameter cannot be found that matches parameter name 'RequireLicenseAcceptance'.
At C:\Program Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\3.1.0\netFramework\ExchangeOnlineManagementBeta.psm1:632 char:17
+ ...             $ImportedModule = New-EXOModule -ConnectionContext $Conne ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Update-ModuleManifest], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.PowerShellGet.Cmdlets.UpdateModuleManifest

Whilst line 632 maps to $ImportedModuleName = $ImportedModule.Name; the error references a line above: $ImportedModule = New-EXOModule -ConnectionContext $ConnectionContext -SkipLoadingFormatData:$SkipLoadingFormatData;

There is another error that isn’t displayed present in $Error[1]:

ErrorRecord                 : Could not find file 
                              'C:\Users\Robin\AppData\Local\Temp\5581087a-a4d6-4d60-87b3-35f9c3ac6efc\tmpEXO_zhvkuacu.osg.psd1'.
WasThrownFromThrowStatement : False
Message                     : Could not find file 
                              'C:\Users\Robin\AppData\Local\Temp\5581087a-a4d6-4d60-87b3-35f9c3ac6efc\tmpEXO_zhvkuacu.osg.psd1'.
Data                        : {}
InnerException              : System.IO.FileNotFoundException: Could not find file 
                              'C:\Users\Robin\AppData\Local\Temp\5581087a-a4d6-4d60-87b3-35f9c3ac6efc\tmpEXO_zhvkuacu.osg.psd1'.
                              File name: 'C:\Users\Robin\AppData\Local\Temp\5581087a-a4d6-4d60-87b3-35f9c3ac6efc\tmpEXO_zhvkuacu.osg.psd1'
                                 at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
                                 at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
                                 at Microsoft.PowerShell.PowerShellGet.Cmdlets.UpdateModuleManifest.EndProcessing()
                                 at System.Management.Automation.CommandProcessorBase.Complete()
TargetSite                  : 
StackTrace                  : 
HelpLink                    : 
Source                      : 
HResult                     : -2146233087

This is referencing a manifest file using a path with a GUID in. The path does exist without the GUID:

image

A few extra notes:

• This problem exists for ExchangeOnlineManagement module version 3.0.0 and 3.1.0. • If PowerShellGet v3 is removed (and 2.2.5 used) then Connect-ExchangeOnline works. • PowerShell 7 on the same machine with the same version of PowerShellGet works. • I’ve not tried previous previews of PowerShellGet v3.

Apologies if this isn't specifically PowerShellGet issue, but we are unable to use these v3 versions on machines that also require ExchangeOnlineManagement which is a pain. If I'm able, I'll try and test other earlier v3 versions of PowerShellGet and earlier versions of ExchangeOnlineManagement.

Expected behavior

Connections to Exchange Online work.

Actual behavior

Failed as documented above.

Error details

Detailed above.

Environment data

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

Visuals

No response

alerickson commented 1 year ago

Hi @robinmalik, this definitely looks like a PowerShellGet issue. Thank you for the extensive debugging information, we'll get this resolved in our next release!

alerickson commented 1 year ago

I'm not able to repro with the current build of master. This should be resolved with our next release (out next week).