Work on generalizations of the Cohen-Lenstra and Cohen-Martinet heuristics has drawn attention to probability measures on the space of isomorphism classes of profinite groups. As is common in probability theory, it would be desirable to know that these measures are determined by their moments, which in this context are the expected number of surjections to a fixed finite group. We show a wide class of measures, including those appearing in a recent paper of Liu, Wood, and Zurieck-Brown, have this property. The method is to work locally with groups that are extensions of a fixed group by a product of finite simple groups. This eventually reduces the problem to the case of powers of a fixed finite simple group, which can be handled by a simple explicit calculation. We can also prove a similar theorem for random modules over an algebra.