Hi estringer,
I think the previous responses might have misunderstood your question. The Vault duplicate search as I understand it looks through all the files (that have been indexed for duplicates) in the Vault to find files that have duplicate geometry to each other, not duplicate file names. It also allows you to search Vault for any parts with geometry matching a part file in the active Inventor assembly, so that you can replace a component in the active assembly with the matching one in Vault, and therefore not add another duplicate to Vault upon check in and gunk up your Vault with duplicates.
So to address your question - yes you can run the command in an assembly with the below single line of code. You can also pre-select a component (using code or manually) and then run the code below.
ThisApplication.CommandManager.ControlDefinitions.Item("VaultFindDuplicates").Execute
However all this will do is open the Find Duplicates form. You'll need to then select what you want to do. Run a search / replace one / replace all, etc.
If you want a more automated approach:
If you're expecting a lot of duplicate parts in your Inventor assemblies (and I see that you are working with curtain walls, so you definitely will :-)) - then you may want to consider a ready-made solution for replacing all the duplicate parts in your Inventor assemblies before you involve Vault. It's an Inventor addin called The Duplicate Replacer and as well as duplicate component replacement (for the entire assembly in one operation if desired) it also allows Part Number iProperty replacement if you only care about BOM merging of parts with identical geometry.
Video on the app:
https://youtu.be/sbFZaeBHehY
Email:
info@ldcadsolutions.co.uk
Full disclosure - I'm the developer, so enormously biased 🙂
Luke