powershell – How to register the output of the barcode scanner?

Is there any way to register the output of a barcode scanner?

We have a problem with our barcode scanner. I can not explain it well, so I'll just leave an image here: https://imgur.com/a/nRZ8en0

Unfortunately, this problem occurs intermittently and the scanner has a carriage return established after each entry (so you can automatically jump to the next field in the text box).

We have 2 hypotheses for this problem: 1) Error in the form 2) The user scans faster than the PC can have time to process the carriage return

Is there a way to have a script / service that registers the output of the scanner in a txt file and at the same time allows the user to use the form normally?