I am getting below error when I run the script for 2 or 3 times then the connection is success full and everything starts working. Then after an idle time the same issue happening.
Exception calling "Open" with "1" argument(s): "Connection has been unexpectedly closed. Server sent command exit status 0. Authentication log (see session log for details): Using username "shakcorp". Server refused our key. Authentication failed." At C:\payment-upload-scripts\payment_upload_script.ps1:59 char:7 + $session.Open($sessionOptions) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) , MethodInvocationException + FullyQualifiedErrorId : SessionRemoteException