Tag Archives: Variables

LDAP Search Favorites

LDAP Search option in Nettools has the ability to save queries as a favorites so they can be used again, there are also options to export and import queries.  To save query as a favorite only takes a few steps, first, setup the query as required, second enter the name in the Favour field and then click on the Save button.

Previously saved favorites can be displayed by clicking on the drop down list at the end of the favorite field. Favorites are saved in the NetTools.ini file using standard ini formatting.  Here is a example of a saved favorite called 'Active Users':

[Active Users]
Options=879892770722381
Server=localhost
BaseDN=cn=project
Filter=(&(objectclass=user)(!useraccountcontrol|=2))
Attributes=samaccountname
DisplayFilter=
Filename=
Sort=
Authentication=1158
Separator=,

NetTools comes with over 280 predefined queries, the full list of queries are here.  More examples and information on other favorites can be found here

Variables

The saved favorites support the use of variables to allow a saved queries to be used on any directory, not just the directory they were originally created against. The following variables are supported:
##default - This will be replaced with the default name context as defined by the defaultNamingContext in the RootDSE
##config - This will be replaced with the configuration name context as defined by the configurationNamingContext in the RootDSE
##root - This will be replaced with the root name context as defined by the rootDomainNamingContext in the RootDSE. V1.30.8 and above
##schema - This will be replaced with the schema name context as defined by the schemaNamingContext in the RootDSE
NULL - This is used to set the field to blank

By default if the field value is not defined in the ini, then field is not changed when the favorite is selected and current value is preserved.

The variable can be entered in the corresponding field before the favorite is saved or by editing the NetTools.ini after the favorite has been saved. The variable are populated when the Populate button is pressed (See LDAP Search Populate), and then by selecting the saved favorite the variable will be replaced with the relevant details.</span">

NetTools also supports the option to share your favorite using the import and export functions, at the end of the favorites field there is three button, to save, export and import a favorite to and from the clipboard.  When the Import button is press the following dialog is displayed and the favorite text can be pasted into the dialog and added.  The imported favorite will be saved based on the name in the the square bracket, if the favorite already exists it will be overwritten.

 

Context Favorites

LDAP Search also support context based favorites, these favorites are not listed in the favorite dropdown list, they are displayed under the Custom menu item on the context menu for the text pane.  With Context Favorites, it is possible to pass the select text in the text output pane to the favorite.

To create a Context Favorite, the name used to save the Favorite must start with ##sel i.e. ##selGet Details.  The favorite will be displayed as Get Details under the Custom on the context menu

The selected text from the Text view pane can be passed to the query by using the ##sel as a substitution for any field in the favorite. 

[##selGet Details (samaccountname)]
Options=879892770719309
Server=
BaseDN=##default
Filter=(samaccountname=##sel)
Attributes=displayname, accountexpires, pwdlastset, lastlogontimestamp, useraccountcontrol
DisplayFilter=
Filename=
Sort=
Authentication=1158
Separator=,

In this example the selected text is expected to be the samaccountname, and the favorite will search and the details of the object.  To prompt what details should be in the selected text, add this to the Favorite name as in the example.

See Favorites for more examples