set-cmcollection does not terminate on name collisions with errors in -errorvariable and doesn't seem to work with try/catch
If we could get this functionality it would go a long way in automating collection management.
If this is still problematic please send us a frown with more details as this reads to me more like a bug than a feature request.
AdminAdam Meltzer (ConfigMgr Product Team) (Software Engineer, Microsoft Endpoint Configuration Manager) commented
Can you provide an example of what you're seeing versus what the expected behavior is for name collisions?
As far as the -ErrorVariable behavior, that may be by design due to how PowerShell works but I'd like more details about what you're seeing so I can confirm.