Choose your language

Choose your login

Support

Normalizing usernames from printer usage

THE PAGE APPLIES TO:

On some systems, when users print their username contains the full context of their name in the domain. In this situation the full context of the username (e.g. jsmith.dept.orgname) is passed through to PaperCut. The print usage will then be tracked against the full context username rather than the standard username (e.g. jsmith).

You could also come across this when using UPNs and Azure AD sync. For example your usernames in PaperCut may be j.smith@orgname.com but your print jobs may be owned by e.g. AzureAD\j.smith@orgname.com. In that case, you’ll want to normalize the username by stripping off the ‘AzureAD\’ part of the username. See example 6 for this case. Note that if you are using Azure AD, and your usernames in PaperCut are UPNs, but you’re seeing jobs denied because e.g. j.smith doesn’t match a username - make sure that that config key user-source.ad.upn-as-username is set to Y. This config key stops PaperCut from stripping off the domain when matching usernames.

PaperCut can be configured to extract the username component of the full username with context. To do this:

  1. Log into the PaperCut admin pages
  2. Go to the Options tab
  3. Press the Config Editor (Advanced) actions link on the left.
  4. Search for the system.normalize-network-username-regex config key.
  5. Enter the regular expression to filter the username and press the Update button next to the value. For example regular expressions, see below.

How Username Filter Regular Expressions Work

Regular expressions are a powerful way to search text, however they can be quite complicated, so some examples have been listed below. For more information on regular expressions see the Regular expression syntax reference and the Regular expression tutorial. There is even an online regular expression tester available over on Regex 101.

The username filter extracts the username from the first matching regular expression group. A regular expression group is surrounded by parenthesis. e.g. (). So the component of the regular expression that matches the username should be surrounded in parenthesis.

Example Regular Expressions

Example 1

To filter username like jsmith.dept.orgname and extract the username jsmith user the following regex:

   ^([^\.]+)

In words this means: from the start of the string, match and extract one or more characters, as long as the character is not a . (period / full-stop). So this matches everything up to the first . character.

Example 2

Novell networks often set the print usersname to something like: .jsmith.dept.orgname (note the leading . character).

To filter username like .jsmith.dept.orgname and extract the username jsmith user the following regex:

   ^\.([^\.]+)

In words this means: from the start of the string, match a single ., then match and extract one or more characters, as long as the character is not a . (period / full-stop). So this matches everything up to the first . character.

Example 3

To filter username like prefix.jsmith.dept.orgname and extract the username jsmith user the following regex:

   ^prefix\.([^\.]+)

In words this means: from the start of the string, match prefix., then match and extract one or more characters, as long as the character is not a . (period / full-stop). So this matches everything between prefix. up to the first . character.

Example 4

To filter usernames that appear both like .jsmith.dept.orgname OR jsmith\DEPT\ORGNAME use the following regex:

   ^\.?([^\.\\]+)

Example 5

Some environments using the LPD / LPR print protocol may see print jobs arriving with IP addresses suffixed to usernames, e.g. jsmith (192.168.4.20). The following regex will extract the username which appears prior to the whitespace character, excluding said whitespace character and the IP address that follows.

   ^([^\s]+)

Example 6

When using Azure AD with Azure-bound workstations, you may find that the job owner is AzureAD\j.smith@orgname.com. In which case you’ll want to strip out the AzureAD\ part of the username to leave the UPN.

   ^AzureAD\\([\S]+)

Categories: How-to Articles , Charging and Billing , User Management


Keywords: Novell Netware NDPS iPrint eDirectory normalise , normalisation , username normalisation , Unix , LPD , LPR , SAP

Comments

Last updated June 13, 2024