Kaseya Community

Need Help with Command Line to find a string in a text file

This question is answered

We have a TXT file with contents -

{"Status":"Online","CurrentScreen":"00","ResponseMessage":"","SerialNumber":"284-753-412","ApplicationVersion":"5.1.4.1","OSVersion":"RFS00190","AdditionalParameters":{"PaymentDataCaptured":"false","RemoveEMVCard":"false"}}

From this TXT file we need to pull the SerialNumber into a new TXT file so we can then upload into a variable and either run other commands or save this to a Custom Field within our VSA. So the exact info for this TXT file we need is the part that reads ---- 284-753-412

I know we need something akin to - 

for /F "tokens=4 delims=," %a in ('findstr "SerialNumber" "#vAgentConfiguration.agentTempDir#\genius_serial.txt"') do echo %a  >> "#vAgentConfiguration.agentTempDir#\serial.txt"

But the above line dies and the serial.txt file is never created on the endpoint.

Verified Answer
  • Never Mind figured it out ... if anyone is running MX915 or MX925 genius devices from Verifone and needs to pull their serial numbers into a custom field in VSA - let us know, we have a script that does that accurately now!

All Replies
  • Never Mind figured it out ... if anyone is running MX915 or MX925 genius devices from Verifone and needs to pull their serial numbers into a custom field in VSA - let us know, we have a script that does that accurately now!