AddUnixProfile

Adds a new UNIX group profile to a zone.

Syntax

IGroupUnixProfile AddUnixProfile(IZone zone, int gid, string name)

IGroupUnixProfile AddUnixProfile(IZone zone, long gid, string name)

Parameters

Specify the following parameters when using this method.

Parameter Description
zone The individual zone to which you are adding a new UNIX group profile.
gid The GID of the new UNIX group profile.
name The name of the new UNIX group profile.

Return value

The UNIX group object created.

Discussion

The UNIX group profile includes the group name and the numeric group identifier (GID).

There are two versions of this method: one designed for COM-based programs that supports a 32-bit signed number for the gid argument and one designed for .NET-based programs that allows a 64-bit signed number for the gid argument.

Exceptions

AddUnixProfile may throw one of the following exceptions:

  • ArgumentNullException if the zone parameter value is null.

  • NotSupportedException if the specified zone has an unrecognized schema.

Example

The following code sample illustrates using AddUnixProfile in a script:

...  
if (objGroup.UnixProfiles.Find(objZone) == null)  
{  
    long next_gid = 10000; // use 10000 as default gid
// Get the next available GID for this zone
if (objZone.NextAvailableGID \>= 0)  
{  
    next_gid = objZone.NextAvailableGID;  
}  
// Add this zone to the group
objGroupUnixProfile = objGroup.AddUnixProfile(objZone, next_gid, strUnixGroup); 

// Save
objGroupUnixProfile.Commit();  
...