Refactor most powershell based methods.