$UserName = 'DOMAIN\DifferentUser'
$PlainPassword = 'StrongPassword'
The snippet of code above is from the code you posted. I'm no ninja at PowerShell but that code seems to imply that the user name and password will exist in clear text, which is a serious violation of all that is holy when it comes to security.
If what I've stated is correct, my recommendation would be to learn how to correctly use Active Directory for such things.
--Jeff Moden
Change is inevitable... Change for the better is not.