My '98's sunroof has all the signs of being posessed. I've read about other people's early year model Passats having similar issues, and with the help of JohnE and TwoManyPassats in this thread, I've fixed my disobedient sunroof.
-Phillips screw driver
-Good pencil eraser (not dried out)
-Isopropyl/rubbing alcohol ... UPDATE: I agree with UrbanLegend (below). You should use DeOxIt as well. If you don't, you'll have to re-clean the assembly every year or so.
...and if your car is anything like mine, a lot of superglue to fix the plastic parts which will just come apart in your hand. (Also, possibly some sticky velcro...)
First, make sure this fix will work for you. I think this applies mostly to 98 and 99 year model Passats... if your controller looks like mine (pay attention to the dots/lines around the rotary knob... different versions have different markings) and your sunroof tilts open on its own and/or won't go to the position you tell it to, this fix might work for you.
First, close your sunroof. If it won't close on its own, you can put your key in the driver's door lock and hold the key in the "lock" position for a few seconds until the sunroof closes on its own. I'm not sure if this is actually important, but every other sunroof repair says to close the sunroof, so there ya go.
Now, hop in the car and remove the little trim access panel near the sunroof control. Start at the front and use your finger or a clean butter knife to pry the edge closes to the sunroof down. It will resist you, but you can get it off. I broke my clips while taking this down (ancient, brittle VW plastic!) and had to superglue them back on. In fact, it looked like they'd been superglued before... yay.
Now remove the dome light cover by pulling on the edge closest to the windshield.
There are two phillips screws near the outer light bulbs. Remove these.
Now slide the whole unit back about half an inch, and then you'll be able to remove it.
Let the whole thing dangle by the two cords. Begin by disconnecting the blue connector on the sunroof motor that runs down to the back of the rotary knob. Next, try to remove the wiring for the overhead lights however you can figure out to. I ended up removing the whole black plug and recepticle from the back of the dome light switch. There are clips directly on the front and rear of the black conenctor that you can remove the whole thing with - this took me about 10 minutes to get off. The lights will blink on and off while you do this. Be careful -- this was brittle feeling.
Now that you have the little panel removed, find a work area and carefully pry off the back of the rotary knob. TwoManyPassats mentioned that this is delicate, and it really is. To remove, you need to put pressure in the little slit you can see towards the back edge on either side. This will allow you to work a fingernail under the edge of the back and begin pulling it up. Mine wouldn't come off and wouldn't come off and finally I pulled on the little clips near the wires and it popped off. You can also see that the clip itself near the wire broke off. Have I mentioned the brittle VW plastic?
Now you're practically done. First, look closely at the back of the knob you just removed.
The contact strips on mine had some obvious wear points. I used the eraser on a nice new mechanical pencil and erased carefully over these strips in a circular motion ... clean your eraser on a sheet of paper as you go ... mine had a lot of black junk on it as I cleaned.
Now, grab your Q-tip and get some isopropyl alchol on the tip. Wipe this in a circular motion. You're done with the back. Update: This is where you'll want to use the DeOxIt if you have any.
Now turn your attention to the oxidized mess of contacts inside the rotary knob.
Carefully clean them with the eraser as well -- wiping occassionally on a piece of paper. You'll be amazed how much better it looks after you're done (I forgot to take a picture...). Once erased, wipe a clean Q-tip with alcohol over the surface and let dry (and/or use DeOxIt). I also decided to use my fingernail to GENTLY bend the contact wires up closer to the electrical contact strip. It took a few tries, as I was being very careful, but it ended up working.
Now, snap the back into the rotary knob and install everything in reverse order. I had to superglue down the metal clips on the back of my headliner access panel and also had to fasten the emergency tool with some velcro as more VW plastic had given way.
This completely fixed the random opening sunroof issue for me. I wish I'd done it 6 months ago when I got the car, but I'm happy to know it was an easy fix. Hopefully this will fix your problems as well! Update: Using just the this problem came back twice in a 2 year period. Cleaning it would fix the problem for a while, but I finally went to Radio Shack and purchased a kit of DeOxIt. It was about $20. Now a few years later after using the DeOxIt, the problem has not reoccurred. I'm a believer -- I've also used the DeOxIt on some small electronics (a switch on a power tool that had started acting up & a shutter button on a camera) so it isn't a one-use purchase.
(Just FYI the part number for the rotary knob on mine was 8D0 959 613. It appears that it can be replaced with 8D0 959 613 A, but that costs over $100 as of Jan 2014.)