There is a tool to do the job; but Microsoft has a way to remove everything preinstalled on your new machine and slowing it down:
https://www.pcmag.com/news/348679/how-clean-up-windows-10-with-the-refresh-windows-tool
It does remove everything but Windows, so it is only suitable for completely new machines.