Preheat your oven to 350°F (175°C) and grease two 9-inch round cake pans.
In a large bowl, whisk together the sugars and oil until combined.
Add the eggs one at a time, mixing well after each addition.
Stir in the vanilla extract and grated zucchini.
In another bowl, sift together the flour, baking soda, baking powder, cinnamon, nutmeg, and salt.
Gradually add the dry ingredients to the wet mixture, stirring until just combined.
If using, fold in the chopped walnuts.
Divide the batter evenly between the prepared pans.
Bake for 30-35 minutes or until a toothpick comes out clean.
Let the cakes cool in the pans for 10 minutes, then transfer to wire racks to cool completely.
Prepare the frosting by beating cream cheese with powdered sugar and vanilla until smooth, then frost the cooled cakes.