Preheat oven to 375 degrees F
Heat oil in a large skillet over medium heat. Add the onion and cook until softened.
Add in the potato with the salt, garlic powder, and black pepper. Cook until the potatoes have started to soften. If using frozen, add them in frozen and cook until defrosted and starting to soften.
Spray a 3 quart baking dish with cooking spray, and pour the potato mixture into the dish. Add the cubed ham and stir to combine.
In the same skillet, melt the butter over medium heat. Add the flour and stir to combine. Stir in the salt, pepper, and garlic powder. Cook this mixture for 2 minutes. Then pour in the milk whisking to combine.
Let this mixture cook until sauce is thickened. Remove from heat and add the cheddar cheese, stir while the cheese melts.
Pour this cheese sauce over the top of the potatoes and ham mixture. Stir to combine and coat the potatoes in the sauce.
Top with 1/4 cup cheddar cheese and 1/4 cup parmesan cheese.
Cover the dish with foil and bake for 30 minutes. Remove the foil and bake an additional 5-10 minutes, or broil for 3-4 minutes until cheese is browned and bubbly on top.
Garnish with fresh parsley and serve.