Add

Adds a new map entry, or individual map record, with the specified key.

Syntax

Entry Add(string key, string value, string comment);
Entry Add(string key);

Parameters

Specify the following parameters when using this method.

Parameter Data type Description

key

String

The key field that uniquely defines this entry in the NIS map.

value

String

The value associated with the key field for this entry in the NIS map.

comment

String

Any optional text string to store in the comment field for this entry in the NIS map.

Return value

An entry object instance for the map entry added.

Discussion

Each map entry consists of three primary fields: a key field, a value field, and an optional comment field. The content and format of the value field depends on the type of NIS map you are working with. For example, if you are setting the value field in a generic map, the field can contain virtually any string that you want served for a corresponding key name. If you are adding a map entry to a netgroup, auto.mount, or auto.master map, the single value field defined in Active Directory may consist of multiple, concatenated fields appropriate for the map type.

Because of potential API name conflict, the Add(string key) method can be used with .NET programs only.

Example

The following code sample illustrates using Add to add new NIS entries to different types of NIS maps:

...
'Identify the zone you want to work with
set zone = cims.GetZone("sample.com/centrify/zones/default")
'Create the Store object
Set store = CreateObject("Centrify.DirectControl.Nis.Store")
'Attach to the target zone.
'Provide the path to the zone and user credentials (username and 'password).
store.Attach zone.ADsPath, "jae.smith", "pas$w0rd"
'Open the generic NIS map named "Remote servers"
Set map = store.open("Remote servers")
'Add an entry to the "Remote servers" NIS map. The input  format is:
'map.add "<key>", "<value>", "<comment>"
map.add "mirage", "127.67.10.1", "Server located in Toledo office"
'Open the NIS map named “auto.master”
Set map = store.open("auto.master")
'Add an entry to the "auto.master" NIS map. The input format is: 'map.add "<mount point>", "<map>" & Chr(11) & "<Options>", "<comment>"
'where:
'<mount point>  - mount point name (key field)
'<map>          - the map file to consult for this mount point
'<options>      - mount options
'<comment>      - text comments
'NOTE The <map> and <options> are separated by a tab character, 'Chr(11), and form the value field for the entry.
map.add "/net", "-hosts" & Chr(11) & "-nosuid,nobrowse", "sample mount"
'Open the NIS map named “auto.mount”
Set map = store.open("auto.mount")
'Add an entry to “auto.mount" NIS map. The input format is:
'map.add "<name>", "<Options>" & Chr(11) & "<network path>", '"<comment>"
'where:
'<name>         - mount point name (key field)
'<options>      - mount options
'<network path> - the network path to consult for this mount point
'<comment>      - text comments
'NOTE The <options> and <network path> are separated by a tab 'character, Chr(11), and form the value field for the entry.
map.add "cdrom", "-fstype=nsfs,ro" & Chr(11) & ":/dev/sr0", "sample mount"
'Open the NIS map named “netgroup”
set map = store.open("netgroup")
'Add entries to the “netgroup” NIS map. The input format is:
'map.add "<group_name>", "<member_name>", "comment"
'where:
'<group_name>  - defines the unique key of this group
'<member_name> - lists the members of the group. Each <member_name>
'                is either another group name, all of whose members
' are to be included in the group being defined,
' or a triple of the form: ' (hostname,username,domainname) '<comment> - comments of this user 'Add a group "db_admin" with three members: dbas, dean, jon map.add "db_admin", "dbas (,dean,) (firebird,jon,)", "All DBAs" wScript.Echo "NIS map entries added." ...