Hi Mark Marco,
As far as I know, the nearest solution to automatically uninstall the old version of .net core sdk is using .NET Uninstall tool. Be sure firstly follow this document and download .NET Uninstall Tool from the tool's releases page.
Then run the following command to removes the .NET SDKs and runtimes, except the highest version:
dotnet-core-uninstall remove --sdk --all-but-latest
Reference: dotnet-core-uninstall remove
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Rena