@AllenXu-MSFT ,
Here’s how you can do this:
- Go to the document library you want to modify.
- Click on the Settings gear in the top-right corner, then select Library settings (or go to Site Settings > Library settings).
- Under General Settings, click on Versioning settings.
- Select Manually for versioning.
- Specify the number of versions you want to retain or set it to retain versions for a specific time period.
- Save the settings.
In Powershell use Set-PnPList cmdlet.
This answers the initial question.