Saute onions and mushrooms in butter for 4-5 minutes. Add soup, cheese and garlic powder. Cook until cheese melts. Add broccoli, rice and ham, mix well.
Stir in pimentos then spoon mixture into baking pan cover and chill for 8 hours.
Bake covered for 40 minutes and then sprinkle with onion strings and serve.