- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2018 10:33 AM
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.
Solved! Go to Solution.
- Labels:
-
Orchestration

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2018 12:40 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2018 10:40 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2018 10:51 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2018 11:01 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2018 11:23 AM
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?