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
  • Updates & Insights
  • Questions
  • Learning
    • E-learning Courses
    • Tutorials
    • 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
    • YouTube Videos
    • Solutions & Use Cases
      • Solutions
      • Use Case Library
    • Agility
      • Learn more about 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)
      • Book your Agile Fundamentals training
      • Book your Kanban workshop
    • >> Go to DataMiner Docs
  • DevOps
    • About the DevOps Program
    • Sign up for the DevOps Program
    • DataMiner DevOps Support
    • Feature Suggestions
  • Downloads
  • Swag Shop
  • PARTNERS
    • Business Partners
    • Technology Partners
  • Contact
    • Sales, Training & Certification
    • DataMiner Support
    • Global Feedback Survey
  • >> Go to dataminer.services

update service by automation with core library

357 views15 hours ago
4
Juan Falcon380 1st June 2026 1 Comment

Hello Dojo

Im creating service with automation core library and works well, im want to add a logic to update the service if existe but i cant find the funciton to remove elements and add the news

if (dms.ServiceExists(grupoCunico.Key))
{
var serviceExist = dms.GetService(grupoCunico.Key);

}

This is my code working in 10.5.0.0-16294-CU6

ServiceConfiguration serviceConfig = new ServiceConfiguration(dms, grupoCunico.Key);
serviceConfig.Views.Add(dms.GetView(63));
serviceConfig.AdvancedSettings.Protocol = dmsProtocol;
serviceConfig.AdvancedSettings.AlarmTemplate = alarmTemplate;

var gruposTroncales = grupoCunico
.GroupBy(x => new
{
// x.Troncal,
x.HostName,
});
int i = 0;
foreach (var grupo in gruposTroncales)
{
i++;
if (dms.ElementExists(grupo.Key.HostName) )
{
engine.GenerateInformation("=======================================");
//engine.GenerateInformation($"Troncal: {grupo.Key.Troncal}");
engine.GenerateInformation($"Host: {grupo.Key.HostName}");
engine.GenerateInformation("---- Registros del grupo ----");

var filters1 = new List<ElementParamFilterConfiguration>();
var filters2 = new List<ElementParamFilterConfiguration>();
foreach (var item in grupo)
{
engine.GenerateInformation(
$"{item.Itm} | {item.IE_Name} | {item.MAC_IE_Local} | {item.MAC_CajaRemota}"
);
filters1.Add(new ElementParamFilterConfiguration(5003, "*", true));
filters1.Add(new ElementParamFilterConfiguration(5004, "*", true));
filters1.Add(new ElementParamFilterConfiguration(5005, "*", true));
filters1.Add(new ElementParamFilterConfiguration(1407, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1419, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1420, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1407, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1405, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1408, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1427, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1412, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1413, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1417, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1418, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1431, "*" + item.IE_Name + " * ", true));

}
var element1 = dms.GetElement(grupo.Key.HostName);

serviceConfig.AddElement(element1.DmsElementId, filters1);
var includedElements = serviceConfig.IncludedElements;
int j = 1;
foreach (var includedElement in includedElements)
{
//includedElement.Alias = "device" + j;
includedElement.IncludedCapped = Skyline.DataMiner.Core.DataMinerSystem.Common.AlarmLevel.Normal;
j++;
}

}
}
agent.CreateService(serviceConfig);

Thanks

Thomas Cauwelier [SLC] [DevOps Advocate] Answered question 15 hours ago
Juan Falcon commented 2nd June 2026

correct, creating again the service gets error for existing.

2 Answers

  • Active
  • Voted
  • Newest
  • Oldest
0
Thomas Cauwelier [SLC] [DevOps Advocate]1.86K Posted 15 hours ago 0 Comments

Hi Juan,

A newly released version of Skyline.DataMiner.Core.DataMinerSystem (1.2.0.3) now allows you to edit an existing service instead of only creating a new one.

The following methods are available on the service configuration:
dms.GetService(grupoCunico.Key).ParameterSettings

  • AddElement(elementId, filters) to add an element with parameter filters.
  • AddService(serviceId) to add a sub-service.
  • RemoveByElementId(elementId) to remove an element.
  • RemoveByServiceId(serviceId) to remove a sub-service.
  • RemoveByAlias(alias) to remove an item by alias.
  • Clear() to remove all included elements and services, which can be useful when rebuilding the service contents from scratch.

Via ParameterSettings.IncludedElements, it is possible to loop over all elements in the service and make changes.

Hope this helps!

Thomas Cauwelier [SLC] [DevOps Advocate] Answered question 15 hours ago
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
Privacy Policy • Terms & Conditions • Contact

© 2026 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