I tried to repair/rebuild my sunroofs, but after trying to replace the drive cables and re-sync everything, I found this following process easier (which includes much of what DiscoStew said, BUT you will need to source an entire, working sunroof assembly (SRA) from a junk yard or DWeb member.
1) Lower headliner
2) Remove Torx screws, detach drain tubes and disconnect any wiring.
3) Lower inside frame retainer and set aside.
4) Gently, but firmly, push up on the perimeter of the SRA. (as DiscosStew stated, this will take some time and force as the assembly is sealed to the roof of the vehicle.) It will pop a little, but as long as you are push on the perimeter frame, you should be good to go.
5) Once loose, take SRA on the roof.
6) Remove any old sealant around the opening. Surface should be clean for new sealant.
7) Temporarily connect wiring and test sunroof for functionality. Connectors should match up.
8) Now, lay down a bead of sealant about 1/4"-3/8" tall. This is to seal the gap under the exterior, perimeter frame.(I used clear silicon so it wasn't too visible).
9) Carefully place the SRA into the open and push down to compress the silicon bead.
10) Re-install the inner retaining frame and torque down screws. (clean excess sealant where it has oozed out from under the exterior frame)
11) Re-attach wiring and drain tubes.
12) Raise headliner.
13) Crack a cold one if you haven't already and enjoy your non-clicking, non-crackling, non-functioning sunroof.
-Chris D.