Search code examples
powershellaws-powershell

WARNING: Multiple variants of AWS Tools for PowerShell are currently installed


When I run a powershell script, I get the following warning:

WARNING: Multiple variants of AWS Tools for PowerShell (AWSPowerShell, AWSPowerShell.NetCore or AWS.Tools) are currently installed. Please run 'Get-Module -Name AWSPowerShell,AWSPowerShell.NetCore,AWS.Tools.Common -ListAvailable' for details. To avoid problems with cmdlet auto-importing, it is suggested to only install one variant. AWS.Tools is the new modularized version of AWS Tools for PowerShell, compatible with PowerShell Core 6+ and Windows Powershell 5.1+ (when .NET Framework 4.7.2+ is installed). AWSPowerShell.NetCore is the monolithic variant that supports all AWS services in a single large module, it is compatible with PowerShell Core 6+ and Windows Powershell 3+ (when .NET Framework 4.7.2+ is installed). AWSPowerShell is the legacy module for older systems which are either running Windows PowerShell 2 or cannot be updated to .NET Framework 4.7.2 (or newer).

Screenshot:

enter image description here

How do I fix the warning? Do I uninstall one or 2 of these modules? Which ones?


Solution

  • Going purely by the error message:

    How do I fix the warning?

    You ensure that only one of the three listed module (groups) is installed:

    Do I uninstall one or 2 of these modules? Which ones?

    Yes. Which ones to uninstall and thereby implicitly which one to keep depends on your needs and which powershell version you have:

    • (a) If you're running Windows PowerShell 5.1 and have .NET Framework 4.7.2+ installed, or you're running PowerShell (Core), keep the AWS.Tools.* modules.

    • (b) If you're still running Windows PowerShell 3 or 4, and have .NET Framework 4.7.2+ or higher installed, keep the AWSPowerShell.NetCore module.

    • (c) If you're still running Windows PowerShell 2 or a higher version, but cannot install .NET Framework 4.7.2+, keep the legacy AWSPowerShell module.

    For instance, to go with (a):

    Note

    • To be safe, run with elevation (as admin), so that removal of modules that were installed in the AllUser scope can be removed.

    • Any non-installed modules among the specified ones are quietly ignored.

    • Start a new PowerShell session afterwards (modules already imported in the current session remain in memory, even after uninstallation; however, you can also remove them individually from memory with Remove-Module).

    Get-Module -ListAvailable AWSPowerShell, AWSPowerShell.NetCore |
      Uninstall-Module -Force