A novel approach to computing time-harmonic solutions of Maxwell's equations by time-domain simulations is presented. The method, EM-WaveHoltz, results in a positive definite system which makes it amenable iterative solution with the conjugate gradient method or GMRES. Theoretical guaranteeing convergence away from resonances Numerical examples illustrating properties EM-WaveHoltz are given.