Knowledgebase: PaperCut > Scripting
How can I find a user by their card number and erase it?
Last modified on 15 August 2020 09:14 PM

In many companies today with prox cards for entry and authentication, there is always the need to accommodate someone who has left their card at home, damaged or lost it, with a temporary replacement. While PaperCut self-association caters for the user linking the loan card with their account, the reverse is not as easy to accomplish automatically.

Fortunately there are 2 commands in the server command arsenal that can form part of any program or script to allow you to look up a user by their card No. and then to blank it out.

When used in conjunction with a USB card reader connected to a PC, with either a program/script of your design to capture the card No. or placing the cursor into the correct place in a batch file and tapping to add the card number. The following commands should form an easier way to manage card number removal.

Look Up User

look-up-user-name-by-card-no <card-no>
Looks up the user with the given user card number and prints out their user name.
           If no match was found an empty line is printed out.
       <card-no> - The user card number to look up.

Blank Users Card Number

Pass the “username” retrieved above into:

set-user-property <username> <property> <value>
Sets a user property.
       <username> - the name of the user. <property> - the name of the property to get. Valid properties include: primary-card-number - the user’s primary card number secondary-card-number - the user’s secondary card number <value> - Any text

When passing the username to the Set-User Properties, structure the command as below to blank out the card number field you are adjusting:

set-user-property “testuser” primary-card-number “ “

Note: There is a space in between the quotes above

Other Server Commands

For more information on using server commands and how to execute them, see Appendix A of the PaperCut manual.

Batch Import Option

It is also possible to clear Card/ID number by using Batch import method. You can set the value of the Card/ID PIN to “-“ to clear the existing number.

Information about batch importing user information is given here.