Retrieves a collection of MonitoringSecureDataHealthServiceReference objects given the RunAs profile identifier. Namespace: Microsoft.EnterpriseManagement
Assembly: Microsoft.EnterpriseManagement.OperationsManager (in microsoft.enterprisemanagement.operationsmanager.dll)

Usage

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

returnValue = instance.GetMonitoringSecureDataHealthServiceReferenceBySecureReferenceId(secureReferenceId)

Syntax

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

Parameters

secureReferenceId

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

Return Value

A read-only collection of MonitoringSecureDataHealthServiceReference objects.

Example

The following example uses the GetMonitoringSecureDataHealthServiceReferenceBySecureReferenceId method to enumerate RunAs profiles and their contents.

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;

namespace SDKSamples
{
	class Program
	{
		static void Main(string[] args)
		{ 	 
			ReadOnlyCollection<MonitoringSecureReference> runAsProfiles;
			ManagementGroup managementGroup;
			managementGroup = new ManagementGroup("localhost");
			runAsProfiles = managementGroup.GetMonitoringSecureReferences();
			foreach (MonitoringSecureReference runAsProfile in runAsProfiles)
			{
				ReadOnlyCollection
					<MonitoringSecureDataHealthServiceReference> 
						healthServiceReferences;

				Console.WriteLine("Profile Name: {0}", runAsProfile.DisplayName);

				healthServiceReferences = managementGroup.GetMonitoringSecureDataHealthServiceReferenceBySecureReferenceId(runAsProfile.Id);

				foreach (MonitoringSecureDataHealthServiceReference reference in healthServiceReferences)
				{
					MonitoringSecureData runAsAccount;
					MonitoringObject	 healthService;

					runAsAccount = reference.GetMonitoringSecureData();

					healthService = managementGroup.GetMonitoringObject(reference.HealthServiceId);

					Console.WriteLine("\t{0} - {1}", healthService.DisplayName, runAsAccount.Name);
			}
		}
	}
} 
}

Remarks

This method helps you to determine which health services are using this profile, and which RunAs account each 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