Sorry to bring out the old post. Whenever you have taken out the battery, for the 2006 GS300, you have to initialize it by pressing and holding the UP button to complete the cycle until it stops. It may take more than 10 seconds but just press it and hold until it stops. Then, once again, all the auto open and close auto function of the moonroof will work again.
The instructions are clearly written in the owner's manual.