MID Server Powershell script file hangs when executing PSCP command

Jean-Fran_ois A
Tera Expert

I have the following line in a MID Server Powershell script file:

 

D:\putty\pscp.exe -v -i D:\keys\private_key.ppk D:\temp\*.txt $scp_destination

 

When the script is executed by the MID server, it hangs when it gets to the above line. Any idea why? Anyway I can debug it?

 

Running the Powershell script in a Powershell window (i.e. ./myScript.ps1) works well.

1 ACCEPTED SOLUTION

Jean-Fran_ois A
Tera Expert

Changing the service account under which the MID server was running solved the problem.

View solution in original post

3 REPLIES 3

Amit Verma
Kilo Patron
Kilo Patron

Hi @Jean-Fran_ois A 

 

Below links could be useful :

https://stackoverflow.com/questions/13686686/does-pscp-work-with-powershell

https://stackoverflow.com/questions/30255854/powershell-script-to-copy-files-from-windows-to-multipl...

https://stackoverflow.com/questions/44420408/debugging-file-transfer-using-pscp-executed-from-powers...

 

You can refer above links and try with the methods suggested.

 

Thanks and Regards
Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

Unfortunately it did not help. The MID server is installed on a Windows server. When I login onto it and execute the Powershell script myself, the files are correctly sent over to the other machine using pscp.

 

When the Powershell script is executed by the MID server after being triggered by a Servicenow instance, it hangs when it hits the pscp command.

 

JeanFran_oisA_0-1714595601098.png

 

Jean-Fran_ois A
Tera Expert

Changing the service account under which the MID server was running solved the problem.