CreateCommand

Creates a command right for the zone.

Syntax

ICommand CreateCommand ()

Return value

A command right for the zone.

Discussion

A command right controls who has permission to run a specific command in a zone.

The profile is not stored in Active Directory until you call the Commit method.

Example

The following code sample illustrates using the CreateCommand method in a script:

...  
// Get the zone object
IHierarchicalZone objZone =  
cims.GetZoneByPath("cn=" + strZone + "," + strContainerDN) as IHierarchicalZone;

if (objZone == null)  
{  
    Console.WriteLine("Zone " + strZone + " does not exist.");  
}  
else  
{  
    ICommand objCmd = objZone.GetCommand(strCmd);  
    if (objCmd != null)  
    {  
        Console.WriteLine("Command " + strCmd + " already exists.");  
    }  
    else  
    {  
        objCmd = objZone.CreateCommand();  
        objCmd.Name = strCmd;  
        objCmd.CommandPattern = strPattern;  
        objCmd.Description = "optional description";  
        objCmd.Commit();  
        Console.WriteLine("Command " + strCmd + " was created successfully.");  
    }  
}  
...