Of course! So I first tried:
Then tried something simpler:
Script here if needed: [PowerShell] onboardScript - Pastebin.com
The only issue I foresee with the script itself is how the 'HR' string is parsed, when using the ISE, it is parsed as an array of sorts (this might not be technically correct). If it is parsed as a raw text string then I would have to amend the script.
Regardless, I would still expect a different response if there was an issue with the input/script. I'm inclined to say this is an issue with the connection or some other configuration setting(s).
Can you get a script to run without passing any parameters in the first instance to just prove it works. I do this via the incident work space typically using just a get-service command and the results should display in a message box:
Here is my test script it will write to the message box and to a file on the server:
Add-Content c:\Temp\ServicesExecutionLog.txt "------------Script Found to run------------" Get-Service | Export-Csv -path "C:\temp\services.csv" Add-Content c:\Temp\ServicesExecutionLog.txt "------------Ending Script------------"
And the Incident Quick action Configuration:
The screen output (I have a powershell menu which is displayed first so the services are not show there but they are in the exported file):
Export output sample:
No luck unfortunately (same error) :/
Not sure if it will help but here is the raw log of the error: Raw log - Pastebin.com
Might see if Ivanti support can suggest anything, seems to be any issue communicating with the server.
This will sound silly but can you run the powershell script on the server ok outside of ISM?
There are no silly questions - especially when speaking with me!
But yes, both scripts work fine when running directly on the server.
Have you configured "winrm" on the Remote Server?
Are you able to call the Remote Script from another Server using Powershell and not from HEAT SM.
I tested your script in my test lab. For me it does seem to work. I got the following message box after I ran the Quick Action (called ForumTest) from the Incident workspace:
And when I look in the Windows PowerShell section in the Event Viewer om the Remote Server it does seem as though it was started (sorry my powershell is not very good so not sure what your script is doing):
I tested using the 2017.2.1 Release.
Perhaps try deleting the QA and Remote Connection and re-creating them. An Object Reference error means the system has not been able to access something and would seem to be before the remote host is even being called. Unfortunately the error message is a "catch all" and is very generic.
When configuring the QA - just assign it to the Administrator Role whilst testing to see if that makes a difference.
Still the same error unfortunately, Martin. As you mentioned, this definitely appears to be before the remote host is being called - I don't see anything in the log files on the remote host and the error is displayed almost immediately.
I am somewhat limited as we are a Cloud customer (inclined to say this is probably related to the cause of the issue) so I am communicating with the Ivanti support team, the service quality tends to be high so I am confident this can get sorted.
In reference to the script, it basically parses an email into a format which can be used to automate the creation of a Service Request. Pretty sure I could reach something similar with a convoluted expression within ISM... buuut, I do want the run program functionality anyway so I would rather get it sorted sooner rather than later. Worst scenario is that I have to scrap some ideas and go for the expression route - it actually might not be all doom and gloom with the addition of RES automation coming soon.
You could try setting AppServer_RuleTrace ON in the Logging Configuration to see if it shows you something in the Logs but I don't have any confidence that it will. At the same time you could also set the IntegrationService Log Level up to DEBUG as that is the service that call the remote host and check that in the logs.
Sorry I can't help any further. Hopefully my colleagues in Cloud Support will find the issue for you.
You've already been a great help, Martin. Appreciate both your and Alasdair's time looking at this
I did look at the debugging earlier but I only set AppServer to DEBUG .
The integration error log does provide some additional detail, perhaps even narrowing in to the source of the problem:
System.NullReferenceException: Object reference not set to an instance of an object. at FRS.IntegrationServer.Service.Controller.GetConnectionDef(TenantConfig tenantConfig, ConnectionObject connectionObject, SyncDef syncDef, String dbConnectionString) in D:\BuildAndRelease\Builds\ReleaseBuilds\2017.3\ahp_saas\IntegrationServer\IntegrationService\Processor.cs:line 952 at FRS.IntegrationServer.Service.Controller.openRemoteRunspace(ScriptDef scriptDef, String schema, Runspace& remoteRunspace) in D:\BuildAndRelease\Builds\ReleaseBuilds\2017.3\ahp_saas\IntegrationServer\IntegrationService\Processor.cs:line 1577 at FRS.IntegrationServer.Service.Controller.ProcessRemoteScript(ScriptDef scriptDef) in D:\BuildAndRelease\Builds\ReleaseBuilds\2017.3\ahp_saas\IntegrationServer\IntegrationService\Processor.cs:line 1439
Look in the Workspace called "Integration Connection". You should have an entry for the name of your remote host connection. The error message from the Integration Service seems to imply that some value here is missing. Here is a Screenshot of mine:
The Type field should contain: FRS.Integration.Connection.RemoteConnectionDef