How to Create a New Security Scope
Updated: November 1, 2013
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(); }
Compiling the Code
The C# example requires:
Microsoft.ConfigurationManagement.ManagementProvider
Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine
adminui.wqlqueryengine
microsoft.configurationmanagement.managementprovider
Robust Programming
For more information about error handling, see About Configuration Manager Errors.
The example method has the following parameters:
Parameter
Type
Description
connection
Managed: WqlConnectionManager
VBScript: SWbemServices
A valid connection to the SMS Provider.
scopeName
String
The name of security scope.
scopeDescription
String
The description of security scope.