The unprecedented centre-of-mass energy available at the LHC offers unique opportunities for studying the properties of the strongly-interacting QCD matter created in PbPb collisions at extreme temperatures and very low parton momentum fractions. With its high precision, large acceptance for tracking and calorimetry, and a trigger scheme that allows analysis of each minimum bias PbPb event, CMS is fully equipped to measure dimuons in the high multiplicity environment of nucleus-nucleus collisions. Such probes are especially relevant for these studies since they are produced at early times and propagate through the medium, mapping its evolution. Inclusive and differential measurements of the Z boson yield will be shown, establishing that no modification is observed with respect to theoretical next-to-leading order pQCD calculations. The validity of the Glauber scaling for perturbative cross sections in nucleus-nucleus collisions at the LHC is confirmed. In addition, the status of the quarkonia measurements (primary and secondary J/ψ, and the 3 Upsilon states) will be reviewed, both in pp and in PbPb collisions.