Skip to content
DataMiner DoJo

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages
Search in posts
Search in pages
Log in
Menu
  • Blog
  • Questions
  • Learning
    • E-learning Courses
    • Open Classroom Training
    • Certification
      • DataMiner Fundamentals
      • DataMiner Configurator
      • DataMiner Automation
      • Scripts & Connectors Developer: HTTP Basics
      • Scripts & Connectors Developer: SNMP Basics
      • Visual Overview – Level 1
      • Verify a certificate
    • Tutorials
    • Video Library
    • Books We Like
    • >> Go to DataMiner Docs
  • Expert Center
    • Solutions & Use Cases
      • Solutions
      • Use Case Library
    • Markets & Industries
      • Media production
      • Government & defense
      • Content distribution
      • Service providers
      • Partners
      • OSS/BSS
    • DataMiner Insights
      • Security
      • Integration Studio
      • System Architecture
      • DataMiner Releases & Updates
      • DataMiner Apps
    • Agile
      • Agile Webspace
      • Everything Agile
        • The Agile Manifesto
        • Best Practices
        • Retro Recipes
      • Methodologies
        • The Scrum Framework
        • Kanban
        • Extreme Programming
      • Roles
        • The Product Owner
        • The Agile Coach
        • The Quality & UX Coach (QX)
    • DataMiner DevOps Professional Program
  • Downloads
  • More
    • Feature Suggestions
    • Climb the leaderboard!
    • Swag Shop
    • Contact
      • General Inquiries
      • DataMiner DevOps Support
      • Commercial Requests
    • Global Feedback Survey
  • PARTNERS
    • All Partners
    • Technology Partners
    • Strategic Partner Program
    • Deal Registration
  • >> Go to dataminer.services

Can a subscript be run on a specific agent ?

Solved1.07K views1st August 2022
0
hans sanders [DevOps Advocate]438 28th July 2022 0 Comments

I want to start a subscript to gather info from a system that is accessible only from a given agent.

Can I specify on what agent an automation subscript is being run?

hans sanders [DevOps Advocate] Selected answer as best 1st August 2022

2 Answers

  • Active
  • Voted
  • Newest
  • Oldest
0
Matthias Declerck [SLC] [DevOps Advocate]2.75K Posted 29th July 2022 5 Comments

Hi Hans,

Based on the comment question " how to retrieve data reported back from a script started in this way ??"

The ExecuteScriptResponseMessage and the ScriptProgressEventMessage has a property called ScriptOutput. This is a key-value pair dictionary.

More info on ScriptOutput: https://docs.dataminer.services/develop/api/types/Skyline.DataMiner.Net.Messages.ExecuteScriptResponseMessage.html#Skyline_DataMiner_Net_Messages_ExecuteScriptResponseMessage_ScriptOutput

Note that the message must be sent synchronously. Therefore, the DEFER option must be set to false.
More info: https://docs.dataminer.services/develop/api/types/Skyline.DataMiner.Net.Messages.ExecuteScriptMessage.html?q=ExecuteScriptMessage

You can use the Engine class to fill in the script values (in the subscript code).
Possible methods are: GetScriptOutput(string key), AddOrUpdateScriptOutput(string key, string value), AddScriptOutput(string key, string value), ClearScriptOutput(string key), ..

More info on that: https://docs.dataminer.services/develop/api/types/Skyline.DataMiner.Automation.Engine.html#Skyline_DataMiner_Automation_Engine_AddOrUpdateScriptOutput_System_String_System_String_

Pseudo-code 1 (SLNet call):

var scriptMessage = new ExecuteScriptMessage()
{
DataMinerID = myDMAID,
ScriptName = "myScript",
//execute the script synchronously
Options = new SA(new[] { $"DEFER:{bool.FalseString}" }),
};
var response = Engine.SLNet.SendSingleResponseMessage(scriptMessage) as ExecuteScriptResponseMessage;

var scriptResult = response?.ScriptOutput;

Pseudo code 2 (Engine):

var scriptOptions = engine.PrepareSubScript("myScript");
// Following option is not needed by default, but can be useful: "indicating whether the script output of the subscript merges the full script output of the current running script."
//scriptOptions.InheritScriptOutput = true;
scriptOptions.StartScript();
Dictionary<string, string> result = scriptOptions.GetScriptResult();

hans sanders [DevOps Advocate] Selected answer as best 1st August 2022
hans sanders [DevOps Advocate] commented 29th July 2022

Thanks’ for your feedback MAthias.

Unfortunately I can not make it work yet..

Using your first pseudo code pops up an error…
My trial code:
var scriptMessage = new ExecuteScriptMessage()
{
DataMinerID = 1226,
ScriptName = “DRM_reading_VMX_ContentIds”
};
var response = Engine.SLNet.SendSingleResponseMessage(scriptMessage);

var scriptResult = response?.ScriptOutput;

but the validation test reports: DMSMessage does not contain a definition for .ScriptOutput…

And your second sample works but here I am unable to specify the subscript should run an a specific agent…

Matthias Declerck [SLC] [DevOps Advocate] commented 29th July 2022

Hi Hans,

Do mind this is pseudo code for pure illustration.
To fix your issue, you must cast the response to the correct message.
“var response = Engine.SLNet.SendSingleResponseMessage(scriptMessage) as ExecuteScriptResponseMessage;”
DMSMessage is the base message for messages.

I’ve updated the pseudo code accordingly.

hans sanders [DevOps Advocate] commented 29th July 2022

Thanks for the clarification Matthias.
I am now able to run the script on the specified agent.
However I did not succeed to read back results.

When I us ethe second method (and start the main script on the correct agent) then I do get results back.
Is any specific option to be declared additionally (such as in the conventional method: .InheritScriptOutput=true ??

Matthias Declerck [SLC] [DevOps Advocate] commented 1st August 2022

Hi Hans,

Now you’ve mentioned it, there is an option that needs to be set.
The script messages are executed asynchronously. so this means that response will not have the stored values. In order to have the values, you must fill in the Defer option to false. Setting the option to false will execute the script synchronously. I’ve updated the pseudo code on how to do this.

Matthias Declerck [SLC] [DevOps Advocate] commented 1st August 2022

I do hope everything works fine and is described clearly.
If so, please do mark this question as resolved by selecting this answer as top answer (top-left corner of this answer section).

You are viewing 1 out of 2 answers, click here to view all answers.
Please login to be able to comment or post an answer.

My DevOps rank

DevOps Members get more insights on their profile page.

My user earnings

0 Dojo credits

Spend your credits in our swag shop.

0 Reputation points

Boost your reputation, climb the leaderboard.

Promo banner DataMiner DevOps Professiona Program
DataMiner Integration Studio (DIS)
Empower Katas

Recent questions

Web Applications exception in Cube due to invalid certificate 0 Answers | 0 Votes
Redundancy Groups and Alarming – Duplicate Alarms 0 Answers | 0 Votes
Correlation Engine: “Test rule” doesn’t result in a hit, despite functional rule 1 Answer | 3 Votes

Question Tags

adl2099 (115) alarm (62) Alarm Console (82) alarms (100) alarm template (83) Automation (223) automation scipt (111) Automation script (167) backup (71) Cassandra (180) Connector (109) Correlation (69) Correlation rule (52) Cube (151) Dashboard (194) Dashboards (188) database (83) DataMiner Cube (57) DIS (81) DMS (71) DOM (140) driver (65) DVE (56) Elastic (83) Elasticsearch (115) elements (80) Failover (104) GQI (159) HTTP (76) IDP (74) LCA (152) low code app (166) low code apps (93) lowcodeapps (75) MySQL (53) protocol (203) QAction (83) security (88) SNMP (86) SRM (337) table (54) trending (87) upgrade (62) Visio (539) Visual Overview (345)
Privacy Policy • Terms & Conditions • Contact

© 2025 Skyline Communications. All rights reserved.

DOJO Q&A widget

Can't find what you need?

? Explore the Q&A DataMiner Docs

[ Placeholder content for popup link ] WordPress Download Manager - Best Download Management Plugin