Problem
When running a PowerShell script that usesInvoke-WebRequest, the following error may appear:

Solutions
- Temporary
- Permanent
To quickly fix this issue in the current session, you can enable the necessary protocols by running the following command in your PowerShell session:However, this fix is temporary and needs to be reapplied in every new PowerShell session.
Explanation of Registry Keys
| Registry Setting | Description | |
|---|---|---|
| SchUseStrongCrypto | Forces the .NET Framework to use strong cryptographic protocols (e.g., TLS 1.2). | |
| SystemDefaultTlsVersions | Ensures .NET applications use the system-default TLS version, allowing them to adapt to newer protocols. |
If the error persists
If the error persists, consider the following actions to ensure secure connections for all .NET applications without requiring manual intervention in each session:- Ensure your system supports TLS 1.2 and that it is enabled in the operating system.
- Upgrade to PowerShell Core or PowerShell 7, which default to modern security protocols.