Skip to content

Instantly share code, notes, and snippets.

@peteristhegreat
Created June 5, 2024 16:38
Show Gist options
  • Save peteristhegreat/ba9ad0839a934f7266477cd0a87968bd to your computer and use it in GitHub Desktop.
Save peteristhegreat/ba9ad0839a934f7266477cd0a87968bd to your computer and use it in GitHub Desktop.
Scoop install when your certificates are held hostage

In case you hadn't heard, scoop is the cool new package manager on the block for Windows painless installs... displacing chocolatey in the case you don't want to rely on admin console windows, or if you don't have admin on the box you are working on.

Installation

In a powershell window, run:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression

Certificate issues

Invoke-RestMethod : The underlying connection was closed: Could not establish trust relationship
for the SSL/TLS secure channel.
At line:1 char:1
+ Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke
   -RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRe
   stMethodCommand

Disable certificate checking temporarily

Add-Type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
    public bool CheckValidationResult(
        ServicePoint srvPoint, X509Certificate certificate,
        WebRequest request, int certificateProblem) {
        return true;
    }
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy

When you are done with your certificate issue, close the session and it will go back to its original certificate handling.

Add buckets

scoop bucket add extras

Install some things

scoop install mingw gow vscode make
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment