The NList Utility

     

The 16-bit NList command-line utility provided with NetWare 4 and above is an extremely powerful tool for examining information in a DS tree. Its power, however, is masked by a fairly complex command-line interface. As with UImport, the NList utility is not used by many administrators because it takes time to learn, and the output can take a significant amount of time to interpret.

The NList command line consists of three parts :

  • The object class to list, with an optional value to look for

  • An optional "where" component, used to filter requests

  • An optional "show" component, used to select fields to display

In addition to these components, several switches are used to modify the output of the NList command. The first of these components is the object class component. Whenever you use NList, you must specify a single class to find information on. The classname used is the name found in the DS schema; you can look it up by using DSBrowse, NDS iMonitor, or the Schema Manager component of ConsoleOne.

You can also limit the object class component by specifying that the name be equal to a single value. The value can include wildcards. For example, to look for only users starting with J , this would be the format of the NLIST command:

 NLIST USER = J* 

This would provide a list of all users whose login name starts with the letter J. Because DS object names are not case-sensitive, specifying J* as the value is the same as specifying j* .

TIP

If you don't know the name of the class, you can list all classes by specifying the * wildcard character in place of a classname. This shows you all objects, regardless of class. You can limit NList when using it in this way by specifying an object name, in the format NLIST * = objectname . This produces a listing showing the object and its class.


The second piece of the NList command line, the optional where component, lets you limit the scope based on an attribute value defined for the object. If the attribute does not fit the values searched for by the where component, the object will not be displayed.

NOTE

Some values, particularly date and time values, are difficult to perform numeric comparisons against. If you want to limit the scope based on a date, you may need to experiment a bit with the value. In cases such as this, it might make more sense to use techniques described in Chapter 7 (such as using the ODBC driver for eDirectory) to build a data file and then use an external program, such as Microsoft Excel, to filter the data more effectively.


If you wanted to list all users whose login name starts with the letter J , but only if the last name starts with H , you would use the following command:

 NLIST USER = J* WHERE SURNAME = H* 

WARNING

There must be a space after the attribute name ( SURNAME , in this example), or NList will display a syntax error message.


As with the object class scope, wildcard characters are supported in the where component of the command.

TIP

If the classname or attribute name includes one or more spaces, you need to enclose the name in quotation marks. For example, if you are looking for a print queue, you need to use NLIST "PRINT QUEUE" and not NLIST PRINT QUEUE .


A number of comparison operators can be used in the where component of the query. Table 12.4 lists them.

Table 12.4. Comparison Operators for the Where Component of an NList Command

COMPARISON OPERATORDEFINITION

EQ

Equal to; can use = instead

NE

Not equal to

LT

Less than

LE

Less than or equal to

GT

Greater than

GE

Greater than or equal to

EXISTS

Exists (that is, a value is present)

NEXISTS

Does not exist (that is, a value is not present)


NOTE

The only comparison that can use a numeric equivalent is testing for equality. The greater than ( > ) and less than ( < ) operators are used by the operating system to pipe information either from a file or to a file in a command prompt session.


When you're testing numeric values, the use of comparisons is very straightforward; however, when you're comparing other values, such as dates or string values, the comparison becomes a bit more difficult to determine. For example, if you execute this command:

 NLIST USER SHOW "Last Login Time" 

the information presented includes a date and time in the format hh:mm:ss [ ampm ] mm-dd-yyyy . However, using this format in a where clause results in the error message "NLIST-4.22-130: Dates prior to 1980 are invalid" . After a bit of experimentation, you find that performing a comparison on this attribute requires just a date value ”a time value will not be accepted. Thus the following command:

 NLIST USER WHERE "Last Login Time" GE "8:00:00 am 2-5-1999" 

results in an error message, but this command:

 NLIST USER WHERE "Last Login Time" GE "2-5-1999" 

generates a listing of desired users. You can obtain the last login times of these users by appending the show component to the command, as illustrated here:

 f:\>nlist user where "last login time" ge "1-1-2004" show "last login time" Object Class: User Current context: Admin.XYZCorp User: admin         Last Login Time: 01:55:08 am 03/28/04 One User object was found in this context. One User object was found. 

Conversely, string comparisons cannot use the LT , LE , GE , or GE comparison operators. Strings can only be checked for existence ( EXISTS ) or nonexistence ( NEXISTS ) and for equality ( EQ ) or inequality ( NEQ ).

Thus this command:

 NLIST USER WHERE SURNAME GE HE 

is invalid, but this command:

 NLIST USER WHERE SURNAME EQ H* 

returns a list of all users where the surname attribute starts with the letter H .

The last of the primary sections of the NList command line is the show section. This section determines which attribute values should be displayed in the output. This section is optional, and if it is omitted, the listing will include the object name and other general field values, depending on the class of object being listed.

If a show directive appears on the NList command line, the list of attributes following the directive is displayed in the output. The list can be comma delimited or not, but any attribute that includes a space must be enclosed in quotation marks.

TIP

The help displayed with the command NLIST /? D shows that commas are required; however, if you have a long list of attributes to display, including the quotes can create problems with the length of the command. Omitting commas may free up enough space to include additional information you want to include.


After the three main NList command line sections are entered, you might want to use a few command-line switches. The first is the /S switch, which is used to search the entire subtree . This is useful if you want to include information on all users from a particular context down.

The /C parameter tells NList not to pause output at the screen boundaries and wait for user intervention. This is useful if you want to just scan the information visually and pause the output or if you want to use your own paging program ”such as MORE.COM. When you're redirecting the output to a file, this parameter is not needed.

The /CO parameter enables you to specify a start context; when it is used in conjunction with the /S parameter, it enables you to search any subtree. The /R switch is similar to the /CO switch, except that it starts at the [Root] of the tree.

TIP

By default, NList uses the current workstation context. Rather than use the /CO switch, you can set the context with the CX command. This saves you space on the command line and has the same effect as specifying the /CO switch in NList.


The /A switch is used to show active connection or server information. If you want to view just information about users who are currently logged in to the tree, for example, you can specify the /A switch to limit the scope of your query to the users who are logged in.

The /B switch is used to display bindery information. The typical use for this is to display users currently logged in to a particular server. The command NLIST USER /A /B results in the same output as the NetWare 3.x utility USERLIST.EXE . Similarly, the command NLIST SERVER /A /B results in the same type of output as the NetWare 3.x SLIST.EXE program.

The /Tree parameter enables you to list the trees available and optionally select a tree to run the command against. The command NLIST /TREE shows all trees available to the workstation.

TIP

As with the /CO switch, you can bypass the /Tree switch by setting the workstation's current tree from Network Neighborhood's NetWare Connections option (in Windows). This is recommended rather than using the /Tree switch to set the current tree because it saves space on the command line for the scope and display parameters.


Specifying /D on the command line displays detailed information about the object; it lists all the attributes defined for the object. This can be a useful way of obtaining attribute values for a number of attributes when the command line might otherwise be too long.

Using /N on the command line instructs NList to display just the object name. This is a more minimalist option than specifying no show fields and can speed up output if all you want is a list of the object names.

NList is an extremely powerful utility for reporting on DS information. As demonstrated in Chapter 14, the output from this program is designed to be human-readable but can be easily manipulated into a machine-readable format. After it is converted, it can then be reported on, using various database and spreadsheet programs, and it can be converted into a format that is usable by UImport.

TIP

If you like a GUI-based alternative to NList, refer to the "Wolfgang's Tools" section, later in this chapter, for a discussion about DSReport.




Novell's Guide to Troubleshooting eDirectory
Novells Guide to Troubleshooting eDirectory
ISBN: 0789731460
EAN: 2147483647
Year: 2003
Pages: 173

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net