How can I find a user by their card number and erase it?
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 / clear out the user’s card ID.
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.
Server commands
If you haven’t used server commands before, it’s worth reviewing the Using and executing server commands section of the PaperCut manual. This will tell you how to run server commands on different platforms - including the syntax to use.
Look up a user by card number
You can use the look-up-user-name-by-card-no <card-no>
command to supply a card ID or card number, and it will then return the username of the user who owns that card number.
From the Server commands reference:
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.
So for example on Windows you would open a command prompt and use the following commands:
cd [app-path]\server\bin\win
(to change directory to the server command directory)server-command look-up-user-name-by-card-no "12345"
(to look up the user who is configured with the card number 12345)
On macOS or Linux you would open a terminal and use the following commands:
cd [app-path]\server\bin\mac
(or whichever Linux installation flavor you have - to change directory to the server command directory)./server-command look-up-user-name-by-card-no "12345"
(to look up the user who is configured with the card number 12345)
Blank or clear out the users card number
You can use the set-user-property <username> <property> <value>
command to update user properties. The ones we’re interested in are the primary-card-number
or secondary-card-number
.
From the Server commands reference:
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
So for example on Windows you would open a command prompt and use the following commands:
cd [app-path]\server\bin\win
(to change directory to the server command directory)server-command set-user-property "testuser" primary-card-number " "
(to set the testuser user’s primary card number to be blank)
Note: there is a space between the final two quotes in the command - so you’re effectively setting the card number to
On macOS or Linux you would open a terminal and use the following commands:
cd [app-path]\server\bin\mac
(or whichever Linux installation flavor you have - to change directory to the server command directory)./server-command set-user-property "testuser" primary-card-number " "
(to set the testuser user’s primary card number to be blank)
Note: there is a space between the final two quotes in the command - so you’re effectively setting the card number to
Batch Import Option
It is also possible to clear out or delete card/ID numbers by using the Batch import method. You can set the value of the Card/ID to -
to clear the existing number.
Information about batch importing user information is given here:
- Standard users - these are users where the password is managed externally, e.g. through Active Directory or Google Workspace. See the Import and update Standard Users documentation for more details.
- Internal users - these are users where the password is managed internally in PaperCut, and you see the ‘change password’ link in the User Details page. See the Import and update Internal Users documentation for more details.
See the Batch import and update user data page for a summary of the differences between the import methods for Standard users vs Internal users.
Categories: How-to Articles , Scripting and APIs , User Management
Last updated June 13, 2024
Comments