公式サイトにアクセスし、インストール手順を確認します。
次に、Windows PowerShellを管理者権限で開き、現在の実行ポリシーを確認します。
Get-ExecutionPolicy
初期状態では Restricted になっています。Chocolatey をインストールできるようにするため、ポリシーを AllSigned に変更します。
Set-ExecutionPolicy AllSigned
変更後、ポリシーが正しく設定されているか確認します。
Get-ExecutionPolicy
もし AllSigned に変更されていない場合は、Windows PowerShellを管理者権限で開き直してください。
続いて、Chocolatey をインストールします。以下のコマンドを実行してください。
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'))
インストールが完了したら、Chocolatey のバージョンを確認します。
choco -v