MonitoringUserRole Class
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Specifies an assigned user role that contains a scope and users.
Namespace: Microsoft.EnterpriseManagement.Monitoring.Security
Assembly: Microsoft.EnterpriseManagement.OperationsManager (in Microsoft.EnterpriseManagement.OperationsManager.dll)
Usage
'Usage
Dim instance As MonitoringUserRole
Syntax
'Declaration
<SerializableAttribute> _
Public Class MonitoringUserRole
Inherits UserRole
[SerializableAttribute]
public class MonitoringUserRole : UserRole
[SerializableAttribute]
public ref class MonitoringUserRole : public UserRole
/** @attribute SerializableAttribute() */
public class MonitoringUserRole extends UserRole
SerializableAttribute
public class MonitoringUserRole extends UserRole
Example
The following example shows how to use the MonitoringUserRole class to retrieve the user roles and their members for each user role in the Management Group.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.EnterpriseManagement;
using Microsoft.EnterpriseManagement.Configuration;
using Microsoft.EnterpriseManagement.Monitoring;
using Microsoft.EnterpriseManagement.Security;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Xml;
using Microsoft.EnterpriseManagement.Monitoring.Security;
namespace SDKSamples
{
class Program
{
static void Main(string[] args)
{
ManagementGroup managementGroup = new ManagementGroup("localhost");
IList<UserRole> roles = managementGroup.Security.GetUserRoles();
foreach (MonitoringUserRole role in roles)
{
Console.WriteLine("Role Name: {0}", role.DisplayName);
if (role.Users.Count == 0)
{
Console.WriteLine("\tNo users are in this role");
}
else
{
foreach (string userName in role.Users)
{
Console.WriteLine("\t{0}", userName);
}
}
}
}
}
}
Inheritance Hierarchy
System.Object
Microsoft.EnterpriseManagement.Common.MonitoringBase
Microsoft.EnterpriseManagement.Common.CreatableMonitoringBase
Microsoft.EnterpriseManagement.Security.UserRole
Microsoft.EnterpriseManagement.Monitoring.Security.MonitoringUserRole
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
MonitoringUserRole Members
Microsoft.EnterpriseManagement.Monitoring.Security Namespace