I want to find the agent id of my dataminer. I use GetAgent(id) now to get the views, services and elements inside DM now. But i want to make it generic without providing the agent id. Is there any method to find it?
Hi Barandisudha,
To retrieve the ID of the DMA on which the script is being executed you can access the following property: Engine.SLNetRaw.ServerDetails.AgentID.
More documentation: https://docs.dataminer.services/develop/api/types/Skyline.DataMiner.Net.ServerDetails.html
![](https://community.dataminer.services/wp-content/uploads/wp-user-manager-uploads/2022/03/97225679.jpg)
You don’t have to initialize anything. The property can be accessed immediately.
var agentId = Engine.SLNetRaw.ServerDetails.AgentID;
yes actually it works. Thank you
I just have to initialize the ServerDetails() to get my agentId?