Preheat the oven to 350 degrees F. Spray a 9 X 13-inch baking pan with a nonstick cooking spray.
In a large skillet add one tablespoon butter and the onions. Sautee over medium heat until the onions are tender about 6 to 8 minutes.
Add the remaining butter and flour and stir in. Cook for about a minute.
Turn to medium-high and gradually add the cream and milk. Continue to cook until the mixture begins to thicken, stirring constantly.
Add 12 ounces, about 3 cups of the cheddar cheese. Stir until the cheese is melted.
Place the sliced potatoes into the baking dish. Season them with salt and pepper and mix in. Add the ham and mix in.
Pour the cheese sauce over top of the potatoes and mix together.
Cover the baking pan with aluminum foil and place in the preheated oven, bake for an hour.
Remove the potatoes from the oven, remove the aluminum foil. Sprinkle the remaining cheese over top of the potatoes.
Place back in the oven and bake for another 20 to 30 minutes, until the cheese starts to brown and the potatoes are tender.
Remove from the oven and serve.