- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2018 06:36 AM
Hi,
I am new to ServiceNow and I could find no right solution for my Problem (Out of the box)
I have defined a PowershellProbe with a script which recieves a Parameter (powershell_param_someparam).
Running the Script from on the GUI works successfully, yet I have no idea how would I be able to Access and Trigger this Pobe from a bussiness rule or another script type.
Is there any way to do it?
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2018 12:29 AM
So,
there is no out of the box solution for this. An update set like the one described here by John j. Andersen needs to be loaded: http://www.john-james-andersen.com/blog/service-now/powershell-probe-and-utility-for-servicenow.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2018 06:41 AM
Hello Mahmoud,
can you add the below line and try once and check logs.
var psResponse = psProbe.execute(true);
gs.log("Executed Powershell Probe");
Thanks,
Jag.
Please mark correct/helpful as needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2018 07:00 AM
Hello,
the line is not being hit.
However I can see he following log record:
org.mozilla.javascript.EcmaError: "PowershellProbe" is not defined. Caused by error in sys_script.84088429f884d700a4debe38ef5cb787.script at line 6 3: 4: gs.log("Executed Powershell Probe 1"); 5: ==> 6: var psProbe= new PowershellProbe( "mid.server.midserver_scom", '127.0.0.1'); 7: gs.log("Executed Powershell Probe 2"); 8: 9: var psResponse = psProbe.execute(true); | |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2018 07:16 AM
Hello Mahmoud,
I guess mid.server.midserver_scom is a property in your system. If it is a property. can you try like below.
(function executeRule(current, previous /*null when async*/) {
var midServer = gs.getProperty('mid.server.midserver_scom');
var psProbe= new PowershellProbe( midServer, '127.0.0.1');
var psResponse = psProbe.execute(true);
gs.log("Executed Powershell Probe");
})(current, previous);
Thanks,
Jag.
Please mark correct/helpful as needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2018 07:50 AM
Hi,
Still the same Problem:
com.glide.script.RhinoEcmaError: "PowershellProbe" is not defined.
sys_script.84088429f884d700a4debe38ef5cb787.script : Line(7) column(0)
5:
6: var midServer = gs.getProperty("mid.server.connector_default");
==> 7: var psProbe= new PowershellProbe(midServer, '127.0.0.1');
8: gs.log("Executed Powershell Probe 2");
9:
10: var psResponse = psProbe.execute(true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2018 08:13 AM
Hi Mahmoud,
Can you let me know if you have written any scripts on table "ecc_agent_script_file"
Thanks
Jag.
Please mark correct/helpful as needed.