if i run it in a windows all by itself there is no issues but running in a Runspace or if modules have been loaded first i am getting the error
Connect-PnPOnline -Url $SiteURL -Credentials $Cred
PowerShell: 7.4.1
Installed Version: 2.5.0
Error: Failed to connect to https://URL. Error details: Could not load type 'Microsoft.Extensions.DependencyInjection.ServiceCollection' from assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=5.0.0.0, Culture=neutral