Find and Remove Duplicate Indexes
sp_BlitzIndex from Brent Ozar will help you find and identify those:

https://www.brentozar.com/blitzindex/sp_blitzindex-duplicate-indexes/

After that You will have to check those indexes on your own and decide which of them are obsolete. This isn't a task I would try automating with any kind of script.