Run powershell script for remoting on MID server

Manasi Marathe
Tera Contributor

I am trying to run a powershell script on MID server for transferring a file from MID to an external server using flow and action. I am using script step to insert cmd on ecc queue for MID server and am not using the powershell step since I do not want to enter separate connection and credential details in Servicenow for MID server.

 

When I run the powershell script directly on MID server in an interactive session, file transfer works successfully. However, when I trigger the flow with script action, I observe the below error which states that access for PSremoting is denied.

 

Connecting to remote server "remote_server" failed
with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.

 

Kindly help me troubleshoot the issue further.

11 REPLIES 11

Amit Verma
Kilo Patron
Kilo Patron

Hi @Manasi Marathe 

 

Are you using Copy-Item in your PowerShell script to copy the file ?

 

Thanks & Regards

Amit Verma


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

Yes Amit. I am using copy-item after pssession.

Hi @Manasi Marathe 

 

You might be running into Multi Hop Remoting issue. Please check the below links to fix it :

https://4sysops.com/archives/solve-the-powershell-multi-hop-problem-without-using-credssp/

https://learn.microsoft.com/en-us/powershell/scripting/learn/remoting/ps-remoting-second-hop?view=po...

 

Thanks & Regards

Amit Verma


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

thanks Amit.

However, given links suggest creating PSSessionConfiguration and CredSSP which can cause vulnerabilities. Is there any other troubleshooting that can be done from Servicenow end?