Orchestration - PowerShell target host

jwl
Tera Contributor

I'm trying to determine what value (server name) goes into the Target host field in a PowerShell activity.  I've read several responses in the community and also the Orchestration Tips and Tricks but my results don't seem to match what is mentioned in the articles - if I understand them correctly.

Simply put, I can only put the name of the mid server in the Target Host field.  If I put the remote server name as the Target host, I get an authentication error.

If the Target Host is the name of the mid server, I can pass a remote server name in as an input variable and the script runs ok. 

Thanks,

Jerry

Here's a screenshot with some notes.

 

find_real_file.png

 

 

 

 

 

1 ACCEPTED SOLUTION

VivekSattanatha
Mega Sage
Mega Sage

Hello,

 

The concept is simple. Target host doesn't mean your PowerShell script will run on your target. Based on your Target host IP your Orchestration activity will select which MID Server to use.

 

If you use MID Server IP as a Target host then ServiceNow will take the credential of your MID Service. If its other than MID Server IP then it will use the credential from the credential table.

 

I hope this might have cleared your doubt

 

Regards,

Vivek

 

View solution in original post

9 REPLIES 9

SanjivMeher
Kilo Patron
Kilo Patron

Target host should be the server where you want to perform the script execution

 

For example, when i want to add a user to Active directory, I give the domain controller ip address in in target host. Then the MID Server knows where it needs to execute these scripts. 


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

jwl
Tera Contributor

Well, that's what I thought was supposed to happen.  I'm sure not seeing that here.  I assume it is something to do with the mid server/remote server setup/authentication.  If that is the case though, I don't understand why this works:

Target Host = midserver1
Script = Get-Process -computername $thecomputername
Input thecomputername = remoteserver1

Do you use $computer in the script to reference the target host?

Thanks,

Jerry

 

 

 

So this is a remote powershell.

 

You have powershell installed on your midserver. You are passing the server name as variable and executing your powershell command. SO mid server becomes your target host


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

jwl
Tera Contributor

Yes, that is what is working for me.  It seems strange to me that the mid server would have to be explicitly specified.  Seems to defeat the purpose of ServiceNow dynamically selecting a mid server to use by application, ip range, dns, etc.

I'm using windows service credentials (https://docs.servicenow.com/product/mid_server/task/t_ConfigMIDSvrSvcCredentials.html),

not windows credentials.  I did not see this in the docs, but is there a property to tell ServiceNow to use one or the other?