Powershell Script & RestAPI & MID Server

YAHYA KOUZI
Tera Contributor

Hello,

 

First of all, sorry if this is not the right place for the subject of my question.

 

I have a powershell script (that uses curl command) that creates incidents in my instance, it runs well throught the "Trouble Ticket Open" API. the problem is that due to our network policies, the server that will run the script cannot reach the instance. The solution as i read in the documentation is to create a MID Server.

 

Well, now the MID server status is up in my instance but the problem is that i don't know how to edit my script to tell it that i want to reach the MID server first.

 

I've tried to change the url of my script from "curl "http://myinstance.service-now.com/api/sn_ind_tsm_sdwan/ticket/troubleTicket"" to "curl "http://myMidServer/api/sn_ind_tsm_sdwan/ticket/troubleTicket"" but it's not working.

 

Please can you tell me what i am missing?

 

Thanks in advance for your precious help!

2 REPLIES 2

codycotulla
Tera Guru

Hi,

 

I believe that you cannot call to the mid-server Java process from another server in your environment. So, you can't use the mid-server Java process as a proxy to get to your ServiceNow instance. However, since your mid-server is "up" that means that your mid-server is able to communicate with your instance. So I believe you can use the computer where the mid-server is running as a proxy server. So you wouldn't be using the mid-server functionality. You would just be using a computer that can reach the ServiceNow instance as a proxy for a computer that can't reach the ServiceNow instance.

Hope this helps. Good luck!

Cody

Manuel Stimac
Mega Sage

Hi @YAHYA KOUZI,

If you already have a nice powershell script I would try to invoke the command from the MID. Should be possible with powershell & Invoke-Command:

Invoke-Command -ScriptBlock {Nice Powershell Script} -ComputerName MIDSERVER

 

If this answer helps you please mark it as Helpful/Solution.
Thanks & Regards - Manuel

 


If my answer helped you, please mark it as Helpful/Solution.
Thanks & many Regards - Manuel