Retrieves a collection of MonitoringSecureDataHealthServiceReference objects from the specified health service identifier. Namespace: Microsoft.EnterpriseManagement
Assembly: Microsoft.EnterpriseManagement.OperationsManager (in microsoft.enterprisemanagement.operationsmanager.dll)

Usage

Visual Basic
Dim instance As ManagementGroup
Dim healthServiceId As Nullable(Of Guid)
Dim returnValue As ReadOnlyCollection(Of MonitoringSecureDataHealthServiceReference)

returnValue = instance.GetMonitoringSecureDataHealthServiceReferenceByHealthServiceId(healthServiceId)

Syntax

Visual Basic
Public Function GetMonitoringSecureDataHealthServiceReferenceByHealthServiceId ( _
		healthServiceId As Nullable(Of Guid) _
) As ReadOnlyCollection(Of MonitoringSecureDataHealthServiceReference)
C#
public ReadOnlyCollection<MonitoringSecureDataHealthServiceReference> GetMonitoringSecureDataHealthServiceReferenceByHealthServiceId (
		Nullable<Guid> healthServiceId
)
C++
public:
ReadOnlyCollection<MonitoringSecureDataHealthServiceReference^>^ GetMonitoringSecureDataHealthServiceReferenceByHealthServiceId (
		Nullable<Guid> healthServiceId
)
J#
public ReadOnlyCollection<MonitoringSecureDataHealthServiceReference> GetMonitoringSecureDataHealthServiceReferenceByHealthServiceId (
		Nullable<Guid> healthServiceId
)
JScript
public function GetMonitoringSecureDataHealthServiceReferenceByHealthServiceId (
		healthServiceId : Nullable<Guid>
) : ReadOnlyCollection<MonitoringSecureDataHealthServiceReference>

Parameters

healthServiceId

The health service identifier for the secure data health service reference object to get.

Return Value

A read-only collection of MonitoringSecureDataHealthServiceReference objects.

Example

The following example demonstrates a use of the GetMonitoringSecureDataHealthServiceReferenceByHealthServiceId method.

C#  Copy Code
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.EnterpriseManagement;
using Microsoft.EnterpriseManagement.Configuration;
using Microsoft.EnterpriseManagement.Monitoring;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Xml;
using Microsoft.EnterpriseManagement.Monitoring.Security;
using System.Security;

class MonSecDataHealth
{
	static void Main(string[] args)
	{
		ReadOnlyCollection<MonitoringObject> healthServiceInstances;
		ManagementGroup managementGroup;
		MonitoringClass healthServiceClass;
		managementGroup = new ManagementGroup("localhost");
		healthServiceClass = managementGroup.
			GetMonitoringClass(SystemMonitoringClass.HealthService);
		healthServiceInstances = managementGroup.
			GetMonitoringObjects(healthServiceClass);
		foreach (MonitoringObject healthService in 
			healthServiceInstances)
		{
			Console.WriteLine("Health Service: {0}", 
				healthService.DisplayName);
			ReadOnlyCollection
			 <MonitoringSecureDataHealthServiceReference> references;
			references = managementGroup.
GetMonitoringSecureDataHealthServiceReferenceByHealthServiceId (healthService.Id);
			foreach (MonitoringSecureDataHealthServiceReference 
				reference in references)
			{
				MonitoringSecureReference runAsProfile;
				MonitoringSecureData runAsAccount;
				runAsProfile = 
					reference.GetMonitoringSecureReference();
				runAsAccount = reference.GetMonitoringSecureData();
				Console.WriteLine("  RunAs Profile: {0}", 
					runAsProfile.DisplayName);
				Console.WriteLine("	RunAs Account: {0}", 
					runAsAccount.Name);
		}
	}
}
}

Remarks

The GetMonitoringSecureDataHealthServiceReferenceByHealthServiceId method helps you to determine which profiles and which profile RunAs account the health service uses.


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 Server 2008, Windows Vista, Windows Server 2003, and Windows XP

Target Platforms

Windows Server 2008,Windows Server 2003,Windows Vista,Windows XP

See Also