AgentManagedComputer Class

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Represents a managed computer to which an agent has been deployed.

Namespace: Microsoft.EnterpriseManagement.Administration
Assembly: Microsoft.EnterpriseManagement.OperationsManager (in Microsoft.EnterpriseManagement.OperationsManager.dll)

Usage

'Usage
Dim instance As AgentManagedComputer

Syntax

'Declaration
<SerializableAttribute> _
Public Class AgentManagedComputer
    Inherits ComputerHealthService
[SerializableAttribute] 
public class AgentManagedComputer : ComputerHealthService
[SerializableAttribute] 
public ref class AgentManagedComputer : public ComputerHealthService
/** @attribute SerializableAttribute() */ 
public class AgentManagedComputer extends ComputerHealthService
SerializableAttribute 
public class AgentManagedComputer extends ComputerHealthService

Example

The following example shows how to obtain information about an agent-managed computer. In this example, mg is a ManagementGroup instance and agentFqdn is the fully qualified domain name of the agent-managed computer from which you want to obtain information.

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Microsoft.EnterpriseManagement;
using Microsoft.EnterpriseManagement.Administration;


namespace SDKSamples
{
    class Program
    {
        const string agentFqdn = "AgentFullyQualifiedDomainName";
             
        static void Main(string[] args)
        {
            try
            {
                ManagementGroup mg = new ManagementGroup("localhost");            
                AgentManagedComputerCriteria agentCriteria = new AgentManagedComputerCriteria("Name = '" + agentFqdn + "'");

                //Get the agent-managed computer with the specified FQDN.
                IList<AgentManagedComputer> agents = mg.Administration.GetAgentManagedComputers(agentCriteria);


                //Make sure one computer is returned
                if (agents.Count > 1 || agents.Count < 1)
                {
                    throw new Exception("Expected one computer with the given FQDN");
                }

                //Display the name of the computer, its primary management server
                //and any failover servers.
                foreach (AgentManagedComputer agent in agents)
                {
                    Console.WriteLine("Computer name: " + agent.ComputerName);
                    Console.WriteLine("Primary management server: " + agent.PrimaryManagementServerName);
                    Console.WriteLine("Failover servers: ");
                    ReadOnlyCollection<ManagementServer> servers = agent.GetFailoverManagementServers();
                    if (servers.Count > 0)
                    {
                        foreach (ManagementServer server in servers)
                        {
                            Console.WriteLine(server.PrincipalName);
                        }
                    }
                    else
                    {
                        Console.WriteLine("No failover servers assigned.");
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Could not display agent information. " + e.Message);
            }
        }
    }
}

Remarks

You can get a collection of the agent-managed computers in a Management Group by using GetAgentManagedComputers.

You can get a collection of agent-managed computers that are managed by a specific server by using GetAgentManagedComputers.

Inheritance Hierarchy

System.Object
   Microsoft.EnterpriseManagement.Common.MonitoringBase
     Microsoft.EnterpriseManagement.Administration.ComputerHealthService
      Microsoft.EnterpriseManagement.Administration.AgentManagedComputer

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows Vista, Windows Server 2003, and

Target Platforms

Change History

See Also

Reference

AgentManagedComputer Members
Microsoft.EnterpriseManagement.Administration Namespace