I am trying to automate a process which involves copying a file from a Windows share to a Red Hat Linux 7.2 server. I am using PowerShell for this and attached is the script (Automation-CSV-FTP-Moodle-Emrollments QA). When I run the script it is breaking at the open session with error. The same script executes ok the QA server. I checked that firewall is dead. No iptables.
Any ideas please. I am running this scrip on my machine and I can connect manually using winscp to the same server with no issues.
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 "root".
Authentication failed."
At D:\Automation-CSV-FTP-Moodle-Emrollments LMS.ps1:28 char:1
+ $session.Open($sessionOptions)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : SessionRemoteException
Exception calling "PutFiles" with "4" argument(s): "Session is not opened"
At D:\Automation-CSV-FTP-Moodle-Emrollments LMS.ps1:38 char:1
+ $session.PutFiles("$SourceSuspendOldPath", "$DestinationSuspendOldPat ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : InvalidOperationException
Exception calling "PutFiles" with "4" argument(s): "Session is not opened"
At D:\Automation-CSV-FTP-Moodle-Emrollments LMS.ps1:43 char:1
+ $session.PutFiles("$SourceTodayPath", "$DestinationTodayPath", $False ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : InvalidOperationException
error log : tail -f /var/log/secure
Jun 29 11:32:01 xxxxxxx sshd[23287]: error: Received disconnect from xxxxxxxxxx: 13: Unable to authenticate [preauth]