Hello,
Sorry, but we don't quite get which groups you want to delete? There is no such notion as 'active' or 'inactive' groups in AD, so you need to define it yourself. Maybe, you are searching for a way to clean up groups without any members in them? What are the criteria? Please explain.