Bring a large pot of water to a boil over medium to medium-high heat so it’s ready when needed for the pasta.
Cook the peas just enough to defrost them. Cook them for about half the package's suggested time.
Preheat the oven to 350°F.
In a medium saucepan, combine the cream of chicken soup, chicken broth, garlic powder, onion powder, and black pepper. Stir well until smooth.
Place the pan over medium heat and stir often until the sauce comes to a simmer. Lower the heat to medium-low to low, cover, and let it gently simmer, stirring occasionally to prevent sticking.
Raise the heat on the pasta water if it’s not boiling yet. Add salt and cook the spaghetti according to package directions for al dente. Drain well and set aside.
Remove the sauce from the heat and uncover. Add 1 cup of cheddar cheese and 2 tablespoons of Parmesan cheese. Stir until melted and smooth.
Combine the spaghetti, ham, peas, and sauce. Stir until evenly mixed.
Transfer the mixture to a large baking dish (approximately 2.7 to 3 quarts) and cover loosely with aluminum foil.
Bake for 25–30 minutes or until hot and bubbly around the edges.
Remove the foil and sprinkle the remaining cheddar and Parmesan cheese over the top.
Bake for 3–5 minutes until the cheese is melted.
Remove it from the oven and let it sit for a few minutes before serving.