Solution to following Error while Installing Chocolatey On Windows for Terraform:


Error details:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(‘https://community.chocolatey.org/install.ps1'))
‘Set-ExecutionPolicy’ is not recognized as an internal or external command,
operable program or batch file.
— — — — — — — — — -
Copyright © Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6 Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(‘https://community.chocolatey.org/install.ps1')) WARNING: An existing Chocolatey installation was detected. Installation will not continue. This script will not overwrite existing installations. If there is no Chocolatey installation at ‘C:\ProgramData\chocolatey’, delete the folder and attempt the installation again.
Please use choco upgrade chocolatey to handle upgrades of Chocolatey itself.
If the existing installation is not functional or a prior installation did not complete, follow these steps:
— Backup the files at the path listed above so you can restore your previous installation if needed.
— Remove the existing installation manually.
— Rerun this installation script.
— Reinstall any packages previously installed, if needed (refer to the lib folder in the backup).
Once installation is completed, the backup folder is no longer needed and can be deleted.
Solution:
- Remove the existing C:\ProgramData\chocolatey folder.
2.Reinstall Chocolatey by rerunning the script.
Please follow action-pan step by step:
1. Go to https://chocolatey.org/install
2. Now copy the following command:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(‘https://community.chocolatey.org/install.ps1'))
3.Paste the copied text into your shell and press Enter.
Wait a few seconds for the command to complete.
If you don’t see any errors, you are ready to use Chocolatey.
Verify the installation by running choco -v
Here is the snippet evidence of successful Chocolatey installation:
Subscribe to my newsletter
Read articles from Mudassir Hussain directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
