  We consider the energy critical nonlinear Schr\"{o}dinger equation in
dimensions $d \ge 3$ with a harmonic oscillator potential $V(x) = \tfrac{1}{2}
|x|^2$. When the nonlinearity is defocusing, we prove global wellposedness for
all initial data in the energy space $\Sigma$, consisting of all functions
$u_0$ such that both $\nabla u_0$ and $x u_0$ belong to $L^2$. This result
extends a theorem of Killip-Visan-Zhang \cite{kvz_quadratic_potentials}, which
treats the radial case. For the focusing problem, we obtain global
wellposedness for all data satisfying an analogue of the usual size restriction
in terms of the ground state $W$. The proof uses the concentration compactness
variant of the induction on energy paradigm. In particular, we develop a linear
profile decomposition adapted to the propagator $\exp[ it(\tfrac{1}{2}\Delta -
\tfrac{1}{2}|x|^2)]$ for bounded sequences in $\Sigma$.
