How to Create a New Security Scope
Applies To: System Center 2012 Configuration Manager, System Center 2012 Configuration Manager SP1, System Center 2012 R2 Configuration Manager
Creating a security scope in System Center 2012 R2 Configuration Manager is simple. All security scopes are defined by the SMS_SecuredCategory Windows Management Instrumentation (WMI) class. Only two properties are required when you are creating a new security scope, the name and description.
To create a new security scope
Set up a connection to the SMS Provider.
Create an instance of the SMS_SecuredCategory WMI class
Set the CategoryName and CategoryDescription properties.
Save the security scope.
Example
The following example creates a new security scope:
Sub CreateSecurityScope(connection, scopeName, scopeDescription)
Dim scope
' Create a new security scope instance.
Set scope = connection.Get("SMS_SecuredCategory").SpawnInstance_()
' Set the required properties.
scope.CategoryName = scopeName scope.CategoryDescription = scopeDescription
' Save the security scope.
scope.Put_
End Sub
public void CreateSecurityScope(WqlConnectionManager connection, string scopeName, string scopeDescription)
{
// Create a new security scope instance.
IResultObject secScope = connection.CreateInstance("SMS_SecuredCategory");
// Set the required properties.
secScope.Properties["CategoryName"].StringValue = scopeName;
secScope.Properties["CategoryDescription"].StringValue = scopeDescription;
// Save the security scope.
secScope.Put();
}
The example method has the following parameters:
Parameter |
Type |
Description |
connection |
|
A valid connection to the SMS Provider. |
scopeName |
String |
The name of security scope. |
scopeDescription |
String |
The description of security scope. |
Compiling the Code
The C# example requires:
Namespaces
Microsoft.ConfigurationManagement.ManagementProvider
Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine
Assembly
adminui.wqlqueryengine
microsoft.configurationmanagement.managementprovider
Robust Programming
For more information about error handling, see About Configuration Manager Errors.
See Also
Security Scope Management
How to Delete a Security Scope
How to Associate an Object with a Security Scope
How to Remove an Object Association with a Security Scope
SMS_SecuredCategory Server WMI Class