Could be one of many things wrong. The switch is the most likely suspect. First you should just clean the contacts. In most cases this fixes the issue.
Go to 501 Parts.com Yamaha 4wd System Parts and Repair and all the information is there.
Depending on year, your switch may under a recall. What year is yours?
Hate to be ignorant but i don't really know what year. I bought it new 4-5 years a go. It never leaves my property and only has 210 miles on it. Garaged. Thank you for the response. I will look into getting the switch cleaned.
Do you have a title or certificate of origin for the machine? If not, you can find the year with a VIN decoder online. The VIN should be located on the lower frame rearward of the front left wheel. You may have to remove or move a piece of plastic to set it.