I've been having trouble with my sunroof for quite some time now. My issue was that it seemed to be getting stuck after going a short distance on the tracks. I went to the parts store inside my local "pontiac" dealer and the parts guy said its probably a $250 or so sensor that says when its open all the way.
Tonight I bought some small magnets (stong little round ones) for my license plate (that's a whole other story) and I was waiting to meet someone so I started to play with the magnets. I ran it over the dome light housing just to the top right of the crack separating the two lights (you should be able to feel the magnets pull a little bit). If it doesn't work right away, keep trying. It worked great for me.