The following papers are relevant: > [1] J. N. S. Bidwell, M. J. Curran, and D. J. McCaughan, Automorphisms of direct products of finite groups, Arch. Math. 86, 481 – 489 (2006). > > [2] J. N. S. Bidwell, Automorphisms of direct products of finite groups II, Arch. Math. 91, 111–121 (2008). For your question you want to look at [2]. This paper describes the automorphism group of $G = H^n = H \times \cdots \times H$ where $H$ is an indecomposable non-abelian group. In this case $\operatorname{Aut}(G)$ has a normal subgroup $\mathscr{A}$ isomorphic to the group formed by the matrices $$\left\{ \begin{pmatrix} \alpha_{11} & \cdots & \alpha_{1n} \\ \vdots & \ddots & \vdots \\ \alpha_{n1} & \cdots & \alpha_{nn}\end{pmatrix} : \begin{align}\alpha_{ii} &\in \operatorname{Aut}(H) \text{ for all } 1 \leq i \leq n \\ \alpha_{ij} &\in \operatorname{Hom}(H, Z(H)) \text{ for all i $\neq$ j} \end{align}\right\}.$$ (The group operation is matrix multiplication, with multiplication defined by composition and addition defined by $(\alpha+\beta)(x) = \alpha(x)\beta(x)$.) Theorem 3.1 of [2] states that $\operatorname{Aut}(G) = \mathscr{A} \rtimes S_n$, where $S_n$ is the symmetric group acting on $G$ by permuting the direct factors. Thus $|\operatorname{Aut}(G)| = |\operatorname{Aut}(H)|^n |\operatorname{Hom}(H, Z(H))|^{n^2-n} n!$ In your case $\operatorname{Aut}(H) \cong D_4$ and $\operatorname{Hom}(H, Z(H)) \cong C_2 \times C_2$, so $|\operatorname{Aut}(G)| = 2^{2n^2+n} n!$.