Create

Creates a new NIS map with the specified name.

Syntax

Map Create(string mapName, string type)

Parameters

Specify the following parameters when using this method.

Parameter Description
mapName The name of the NIS map you want to create.
type The type of NIS map to create.

Return value

The map object created.

Discussion

When you use this method to create NIS maps, you can specify just the map name or the map name and map type. Internally, however, the map name and type defines how fields are parsed and interpreted for standard network maps and generic maps. For example, the netgroup map name can only be used to create a netgroup type of NIS map. In most cases, you should only create generic maps (key value pairs) using this method to prevent NIS maps from becoming unusable due to unexpected formatting.

Exceptions

Create may throw one of the following exceptions:

  • COMException if there is an LDAP error. LDAP errors can occur if the connection to the LDAP server fails, the connection times out, invalidcredentials are presented, or there are other problems communicating with Active Directory.

  • ArgumentException if the map name is not valid.

Example

The following code sample illustrates using Create to add new NIS maps to a zone:

...
'Identify the zone in which the NIS maps will be created
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"
'Use store.Create to add a generic NIS map in this zone.
store.Create "Contact List","Generic Map"
'Use store.Create to also add the auto_master NIS maps
store.Create "auto_master","AutoMaster Map"
'Use store.Create to add a automount NIS map
store.Create "automounts","Automount Map"
'Use store.Create to add a netgroup NIS map
store.Create "netgroup","Netgroup Map"
wScript.Echo "NIS Maps added to " & zone.Name
...