Make sure you have installed the powershell module ImportDependency and Pwsh
Create a lib subdirectory like in this path C:\faststats\scripts\npgbulk and put the unzipped nuget packages npgsql.10.0.1 and microsoft.extensions.logging.abstractions.10.0.3 in there.
This script exports like 4m rows just in a few seconds.
SL "C:\faststats\scripts\npgbulk"