Could also be the relay and or fuses. A dud relay or fuse will stop the whole show rather than individual issues with the switch pack. Intermittent operation seems to suggest a sticking relay. I'm sorry just at the moment I don't have ready access to more info but if you do a web search on relay layout for a P38 Range Rover ... or the Electrical Troubleshooting Manual in RAVE, find the particular relay (in the fuse box next to the main battery) responsible for windows and sunroof and check its operation....
Good luck with it...let us know how you got on!
MY99 RR P38 HSE 4.6 (Thor) gone (to Tasmania)
2020 Subaru Impreza S ('SWMBO's Express' )
2023 Ineos Grenadier Trialmaster (diesel)
Bookmarks