I was doing something like described in this post to save credentials in a secured file so our automated process can use that to run remote PS scripts via Invoke-command: ht
You have to create the password string on the same computer and with the same login that you will use to run it.