In the case of $\Bbb{M}_n(\Bbb{C})$, you should diagonalize $a$, say $d(\lambda_1,\cdots,\lambda_k)$. d(\lambda_1,\cdots,\lambda_n)$. Then $a^{1/2}$ is $d(\sqrt{\lambda_1},\cdots,\sqrt{\lambda_k})$. d(\sqrt{\lambda_1},\cdots,\sqrt{\lambda_n})$. Easily you can find $a^{-1/2}$ (since $a^{1/2}$ is of course invertible). The rest is just following the previous answer:
$x=a^{-1/2}(a^{1/2}ba^{1/2})^{1/2}a^{-1/2}.$
Then you can return the basis to the previous one (i.e. the basis before diagonalization of $a$).

