Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWSTools.Powershell\tools\chocolateyInstall.ps1 uses deprecated commands #260

Closed
ghost opened this issue May 10, 2022 · 1 comment
Closed
Labels
guidance Question that needs advice or information. module/powershell-cmdlets

Comments

@ghost
Copy link

ghost commented May 10, 2022

Describe the bug

Unable to install AWSPowershell due to C:\ProgramData\chocolatey\lib\AWSTools.Powershell\tools\chocolateyInstall.ps1 trying to call deprecated commands (Write-ChocolateySuccess)

Expected Behavior

Running the following command results in a successful installation of AWsPowershell without any errors:

Install-Module -Name AWSPowerShell -Force

Current Behavior

Running Install-Module -Name AWSPowerShell -Force results in the following error:

ERROR: The term 'Write-ChocolateyFailure' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

The install of awstools.powershell was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\AWSTools.Powershell\tools\chocolateyInstall.ps1'.
 See log for details.

Chocolatey installed 1/2 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - awstools.powershell (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\AWSTools.Powershell\tools\chocolateyInstall.ps1'.

Reproduction Steps

Run 'Install-Module -Name AWSPowerShell -Force'

Possible Solution

No response

Additional Information/Context

I raised an issue on the Choco GitHub page, and I they said the problem sits with AWS as they should be updating their choco package to not use the deprecated commands it is currently using.

AWS Tools for PowerShell version used

I cannot install the tools at all, but I imagine 'Install-Module -Name AWSPowerShell -Force' is trying to install the latest version

PowerShell version used

PowerShell v5.1.14409.20180811

Operating System and version

Windows Server 2016

@ghost ghost added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 10, 2022
@ashishdhingra
Copy link
Contributor

Hi @campanellaf,

Good morning.

Thanks for opening the issue. AWS Tools for PowerShell does not use chocolatey which appears to be package manager for Windows. By default, the AWS Tools for PowerShell gets installed under <<UserDirectory>>\Documents\PowerShell\ or C:\Program Files\WindowsPowerShell\Modules, without any trace for chocolatey. If you look at your installation path, it is C:\ProgramData\chocolatey, which appears to be managed by chocolatey package manager. I'm unsure how chocolatey package manager works and how lib\AWSTools.Powershell\tools\chocolateyInstall.ps1 was generated. This is not the result of the default AWS Tools for PowerShell install, may be managed by this 3rd party package manager.

For testing purposes,
NOTE: On Windows Server 2016, you might have to use command [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 in Windows PowerShell for any installation issues.

  • Launched new EC2 instance (Windows Server 2016).

  • Executed command from Windows PowerShell (launched as Administrator) Install-Module -Name AWSPowerShell -Force.
    RESULT: The AWSPowerShell module got installed under C:\Program Files\WindowsPowerShell\Modules. There is no trace of chocolatey in C:\Program Files\WindowsPowerShell\Modules\AWSPowerShell\4.1.81.

  • Uninstalled AWSPowerShell module using command Uninstall-Module AWSPowerShell.

  • Installed chocolatey package manager using PowerShell instructions at https://docs.chocolatey.org/en-us/choco/setup#installing-chocolatey

  • Closed and relaunched Windows PowerShell (as Administrator).

  • Executed command from Windows PowerShell Install-Module -Name AWSPowerShell -Force.
    RESULT: The AWSPowerShell module again gets installed under C:\Program Files\WindowsPowerShell\Modules. There is no trace of chocolatey in C:\Program Files\WindowsPowerShell\Modules\AWSPowerShell\4.1.81.

  • Uninstalled AWSPowerShell module using command Uninstall-Module AWSPowerShell.

  • Executed command choco install awstools.powershell (based on https://community.chocolatey.org/packages/AWSTools.Powershell).
    RESULT: choco command appears to install AWS PowerShell module (old version) at C:\ProgramData\chocolatey\lib\AWSTools.Powershell which contains C:\ProgramData\chocolatey\lib\AWSTools.Powershell\tools\ chocolateyInstall.ps1. Then it throws installation error ERROR: The term 'Write-ChocolateyFailure' is not recognized as the name of a cmdlet, function from the log.

So looks like the community submitted AWSPowerShell chocolatey package has the issue (which also might be out of date and installing older version of AWSPowerShell module). This 3rd party chocolatey package is not maintained or supported by AWS team.

The recommended and supported way to install AWS Tools for PowerShell is to use official AWS sources (refer Installing the AWS Tools for PowerShell on Windows). I'm unsure how your systems are configured and how chocolatey package manager is integrated with Windows PowerShell. You may try uninstalling chocolatey (https://docs.chocolatey.org/en-us/choco/uninstallation) if it is not being used for any other package management.

Thanks,
Ashish

@ashishdhingra ashishdhingra added guidance Question that needs advice or information. and removed bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 10, 2022
@aws aws locked and limited conversation to collaborators May 10, 2022
@ashishdhingra ashishdhingra converted this issue into discussion #261 May 10, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
guidance Question that needs advice or information. module/powershell-cmdlets
Projects
None yet
Development

No branches or pull requests

1 participant