What is/are: Path Label Examples


Path Labels are a feature of NSS that allow the creation of an organization-close analysis of file service usage. Instead of displaying UNC paths with growth statistics and usage numbers, organizations can create analyses that show growth by region, department or project - or historical usage by country, cost center or manager, etc.

A number of Knowledge Base articles are available that provide information on this topic. It is important to be aware of each:

  • Usage: Configure Path Labels [KB-3116]
  • Reference: Path Label Examples (this article)
  • Reference: Path Label Functions [KB-3140]

This article provides examples of Path Labels that can be adapted and used in your environment. It is recommended that KB-3116 should be read before beginning to configure Path Labels in your environment. Additionally, KB-3140 should be used to reference specific functions when preparing Path Labels.

Microsoft Developer Network offers a useful regular expression language guide.
Regex 101 offers a useful sandbox for writing regular expressions.
NOTE: NSS specific functions are not listed/supported in these external resources

Path Label Examples

The following Path Label examples are intended to be used as templates. It is likely that only the search domain needs to be changed before they can be applied correctly in any environment. In the examples, the domain is set to dq.local. Make sure that this value reflects the name of your domain before testing the queries.

Please bear in mind that some variables may differ depending on how Active Directory is configured in your environment. Each Path Label query example includes a screenshot to illustrate the query in action.

Home Shares - User Name

This Path Label collects the AD sAMAccountName property of Home Share Owners. This will make it easy to detect who's responsible for the Home Share in question. The results can later be used in different widgets in order to display the current usage of the home shares and their growth rates.

  • ad.getuserprop("name", "dq.local", "sAMAccountName", path.lastdir())

Real User Name

Home Shares - User Name with Error Handling

This Path Label collects the AD sAMAccountName property of Home Share Owners, but the difference between this one and the previous one is that it has an inbuilt Error Handling-feature. If no user name is found, the string "N/A - User not found" will be printed out (you are free to decide what should be printed out).

  • ifelse(str.isEqual(ad.getuserprop("name", "dq.local", "sAMAccountName", path.lastdir()), "###ERROR###"), "N/A - User not found", ad.getuserprop("name", "dq.local", "sAMAccountName", path.lastdir()))

Real User Name: Error Handling

Home Shares - Departments

This Path Label collects the AD Department property of Home Share Owners. The results can later be grouped in a widget in order to display how much each department stores in its associated Home Shares.

  • ad.getuserprop("department", "dq.local", "sAMAccountName", path.lastdir())

Home Shares: Departments

Home Shares - Office name

This Path Label collects the name of the office where the Home Share owner works (PhysicalDeliveryOfficeName property). The results can later be grouped in a widget in order to display how much each office stores in its associated Home Shares.

  • ad.getuserprop("physicaldeliveryofficename", "dq.local", "sAMAccountName", path.lastdir())

Office Name

Home Shares - Taking OU from distinguishedName (using String Search on AD-results)

This Path Label expression allows you to search for a specific string in the retrieved AD-result and and then replace it with a word/name of your preference. In this particular use case we want to group the home share usage based on the different organizational units/sub domains in Active Directory. This information is stored in the 'distinguishedName'-property. The problem here is that this property is multi-valued, meaning that we need to isolate a specific term through string-searching.

Example of how the distinguishedName-property could look like for a user (the value of interested is underlined):

  • CN=Dino Horatio,OU=Sales,DC=dq,DC=local

The example below searches through the entire AD-forest and retrieves the distinguishedName for each user associated with Home Share processed. It then searches through the distinguishedName string retrieved and looks for specific terms (e.g. "OU=Sales", "OU=Engineering", "OU=Directors"). Every entry that matches with these terms will be given an appropriate label (e.g. "Sales", "Directors", "Engineering").

Results with no match will be shown as 'Not Listed'. The example screenshot below shows many entries as 'Not Listed' because there are more organizational units in AD than the three specified in the query.  

  • ifelse(rx.contains(ad.getuserprop("distinguishedName", "dq.local", "sAMAccountName", path.lastdir()), "OU=Sales"), "Sales",
    ifelse(rx.contains(ad.getuserprop("distinguishedName", "dq.local", "sAMAccountName", path.lastdir()), "OU=Engineering"), "Engineering",
    ifelse(rx.contains(ad.getuserprop("distinguishedName", "dq.local", "sAMAccountName", path.lastdir()), "OU=Directors"), "Directors", "Not Listed")))

AD String search

For each ifelse-clause added, a paranthesis must be added at the very end of the function to properly close it.

Home Shares - Account status

This Path Label checks the last logon date for users associated with Home Shares (sAMAccount matches folder name) and labels all Home Shares belonging to users who have not logged on since Dec 31st, 2014 23:59:59 as "Inactive - User name" and all users who have logged on since this date as "Active".

This LastLogonTimeStamp is expressed using Windows File Time. A Windows file time is a 64-bit value that represents the number of 100-nanosecond intervals that have elapsed since 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC).

  • ifelse(str.isless(ad.getuserprop("lastlogon", "dq.local ", "sAMAccountName", path.lastdir()),"130645404000000000"),"Inactive - "+path.lastdir(),"Active")

Inactive / Active Users

Home Shares - Owner Status with Manager

This Path Label shows you the Account status for owners of Home Share. It checks whether the user account associated with the Home Share is Enabled or Disabled in Active Directory. If it's Enabled, the result will print  'Enabled'. If it's Disabled, it will print 'Disabled' along with the name of the Manager for the user in question. This will make it easy to identify inactive Home Shares and then contact the responsible managers in order for appropriate action to be taken.

The first part of the query checks if the userAccountControl value for each user matches 66050 or not. This is the value for a user account that is Disabled and that has a password that's set to "never expire". This number can be found in your Active Directory. Look in the detailed list for the "userAccountControl" parameter. This is displayed in HEX, but double-clicking on it shows the decimal value.

It's very common that this value is set to 514 in production environments where the user passwords do expire. If this is the case, use 514 instead of 66050 in the query.

If there's a match with the userAccountControl value (66050 in this example), the status 'Disabled' will be printed along with the name of the user's Manager. If there's no match, the status 'Enabled' will be printed out.


  • ifelse(
                           str.isequal(ad.getuserprop("userAccountControl","dq.local","sAMAccountName",path.lastdir()), "66050"),
                "Disabled - " +  ad.getuserprop("cn","dq.local","distinguishedName",
                    str.isequal(ad.getuserprop("userAccountControl","dq.local","sAMAccountName",path.lastdir()), "###ERROR###"),

Disabled Users and their Managers

Group Shares - Department (using Path Level)

This Path Label looks at a specific level of the path. The query below is set to look at level 3 (the level that contains the Department name in this file system), but it's possible to change this value to a level that suits your environment best. The preferred level is entirely dependent on how the filesystem is structured.

  • path.level(3)

Path Level

Group Shares - Departments (using String Search)

This Path Label expression allows you to search for a specific string in the path and then replace it with a word/name of your preference. It's a very good way to convert otherwise cryptic or ambigious Group Share/Department Share names into something more comprehensible.

Whilst the previous example looks at a specific Path Level, this query searches through the entire path for the specified string. This can be very useful if Group Shares are located on different levels of the filesystem(s).

The example below searches through all paths for the string "Field-Engineering" and converts it to "Field Engineering". Every path that does not match this condition will be shown as "Not Listed". In terms of Path Levels, "Field-Engineering" is located at Path Level 4, while the majority of the Group Shares are located on Path Level 3. This share is selected to illustrate how the query can be used, regardless of the different Path Levels.

  • ifelse(rx.contains(path.full(), "Field-Engineering"), "Field Engineering", "Not Listed")

Path Labels: Specific String Search

Similar to SQL, it is possible to search for more than just one specific string. It's possible to include numerous strings in the expression, thus making it possible to convert multiple Group Shares into their respective Department names (or any words of your preference).

Add a new entry of the rx.contains-query to each row and separate each entry with a comma at the end. For every string search condition added, add a paranthesis at the end of the function to close the added 'ifelse' clause. See the example below that looks for 5 different strings:

  • ifelse(rx.contains(path.full(), "Development"), "Development",
     ifelse(rx.contains(path.full(), "Field-Engineering"), "Field Engineering",
     ifelse(rx.contains(path.full(), "Customer-Support"), "Customer Support",
     ifelse(rx.contains(path.full(), "Marketing"), "Marketing",
     ifelse(rx.contains(path.full(), "Finance"), "Finance", "Not Listed")))))

Path Labels: Multiple String Search


Group Shares & Home Shares - Department

This Path Label query works just as the previous one, but the difference here is that we're also including the User Shares to the function. This label can then be applied to both 'Home Shares' and 'Group Shares' Path Categories. In the example we're searching for the term "Users" and we replace the result with an AD-query that looks for the user's department instead of a specific string. This query is a familiar one as it was featured earlier in this document under "Home Shares - Department".

  • ifelse(rx.contains(path.full(), "Development"), "Development",
     ifelse(rx.contains(path.full(), "Field-Engineering"), "Field Engineering",
     ifelse(rx.contains(path.full(), "Customer-Support"), "Customer Support",
     ifelse(rx.contains(path.full(), "Marketing"), "Marketing",
     ifelse(rx.contains(path.full(), "Finance"), "Finance",
     ifelse(rx.contains(path.full(), "Users"), ad.getuserprop("department", "dq.local", "sAMAccountName", path.lastdir()),"Not Listed"))))))

Path Label: String Search (Groups & Users)

The image below shows a Dashboard that consists of two widgets, both using the Path Label described above. One widget displays the department growth over time and the other displays current usage details. This is an excellent way to keep track of the different departments within the organization, regardless of whether data is being saved in Home Shares or Group Shares.



  • KB3116 How to: Configure Path Labels
  • KB3140 What is/are: Path Label Functions
  • KB Article: 3141

    Updated: 11/15/2018

    • Category
      • Reference
    • Affected versions
      • NSS 9.8
      • NSS 9.81
      • 9.90.22449.1810 [9.90 SR1]

    North America HQ

    NORTHERN Parklife, Inc.
    301Edgewater Place, Suite 100
    Wakefield, MA 01880

    Voice: 781.968.5424
    Fax: 781.968.5301



    Additional Contact Information


    NORTHERN Parklife AB
    St. Göransgatan 66
    112 33 Stockholm

    Voice: +46 8 457 50 00


    Northern Parklife

    ©2018 northern parklife

    privacy statement 
    terms of use