Skip to content

Instantly share code, notes, and snippets.

@JustACasual
JustACasual / Auto-Install-CertificatesInWSL.ps1
Last active March 17, 2025 14:10 — forked from emilwojcik93/Auto-Install-CertificatesInWSL.ps1
The script searches for certificates with a specific description pattern. It exports each certificate, installs them in WSL, and checks the response using curl. If the response is not correct, it tries the next certificate from the results. If the list is done and WSL still responds with an incorrect answer, it throws an error.
<#
.SYNOPSIS
This script searches for certificates with a specific description pattern, exports them, installs them in WSL, and checks the response using curl.
In case Script execution is not allowed on the system, you can run the following command to allow the script to run:
powershell -ExecutionPolicy Unrestricted
.DESCRIPTION
The script searches for certificates with a specific description pattern. It exports each certificate, installs them in WSL, and checks the response using curl. If the response is not correct, it tries the next certificate from the results. If the list is exhausted and WSL still responds with an incorrect answer, it throws an error.
.PARAMETER DescriptionPattern
The pattern to search for in the certificate description. Default is "CA".
.PARAMETER ExcludeIssuers