aws / aws-tools-for-powershell

The AWS Tools for PowerShell lets developers and administrators manage their AWS services from the PowerShell scripting environment.
Apache License 2.0
239 stars 79 forks source link

Install-AWSToolsModule error #94

Closed madmox closed 4 years ago

madmox commented 4 years ago

Expected Behavior

The following command should install the AWS.Tools.SimpleSystemsManagement powershell module:

Install-AWSToolsModule -Name "AWS.Tools.SimpleSystemsManagement" -CleanUp

Current Behavior

The command throws the following error:

ForEach-Object : Cannot validate argument on parameter 'MaximumVersion'. The argument is null. Provide a valid value for the argument, and then try running the command again.
Au caractère C:\Users\mrossini\Documents\WindowsPowerShell\Modules\AWS.Tools.Installer\1.0.0.1\AWS.Tools.Installer.psm1:237 : 33
+ ... s = $Name | ForEach-Object { Find-Module -Name $_ @findModuleParams @ ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData : (:) [ForEach-Object], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.ForEachObjectCommand

Steps to Reproduce

Your Environment

matteo-prosperi commented 4 years ago

Hello, I was not able to reproduce the issue.

PS> get-module aws.tools.* -ListAvailable
PS> Install-Module -Name AWS.Tools.Installer -Scope CurrentUser -AllowClobber

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): y
PS> get-module aws.tools.* -ListAvailable

    Directory: C:\Users\prospm\Documents\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.0.0.1    AWS.Tools.Installer                 {Uninstall-AWSToolsModule, Install-AWSToolsModule, Update-AWSToolsModule}

PS> Install-AWSToolsModule -Name "AWS.Tools.SimpleSystemsManagement" -CleanUp -AllowClobber

Confirm
Are you sure you want to perform this action?
Performing the operation "Install-AWSToolsModule" on target "AWS Tools version 4.0.1.1".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
Installing module AWS.Tools.SimpleSystemsManagement version 4.0.1.1

Could you please share the result of running Get-Module PowerShellGet -ListAvailable and Get-Module AWS.Tools.* -ListAvailable.

Could you also run Install-AWSToolsModule with -Verbose:

Install-AWSToolsModule -Name "AWS.Tools.SimpleSystemsManagement" -CleanUp -Verbose

and attach the output.

Thanks!

madmox commented 4 years ago

I am not able to reproduce the issue. Note that to be able to continue my work, I had to install the full AWSPowerShell.NetCore in between, so even though I unsinstalled it properly to try to reproduce the bug, it might have changed the initial conditions.

matteo-prosperi commented 4 years ago

The latest release of the AWS.Tools.Installer module have lots of code changes around the Find-Module calls. It may be worth giving updating a try in case you are affected by this problem again. I am closing this for now because it cannot be reproduced. Please reopen in case it happens again. Thanks for reporting this issue.

mjohnston-vtx commented 3 years ago

I know this is closed, but just leaving this comment here in case anyone Googles it and ends up here:

I had this issue and it was caused by the ExecutionPolicy on my Windows machine. (Mine was set to Restricted).

Running Set-ExecutionPolicy -ExecutionPolicy AllSigned addressed the issue for me. (Here's MS's doc on Execution Policies: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.1).