Page 1 of 1

Find data in an external database with Batch

Posted: 08 Feb 2022 17:51
by MauricioDeAbreu
Good friends.

I come to you, since I have been given a task at work that far exceeds the little knowledge I have about Batch.

The point is that you need to verify if the serials of some hardware components (obtained by CMD) are the ones in the database.

For example: I obtain through the Batch the serial of the equipment, of the memories, of the hdd, of the processor, etc.

Then the equipment serial is searched in a database, and when matching, the rest of the serials must be validated.

If everything is fine, it does not show any alert, if there is a discrepancy, it shows an alert based on the changes.

The million dollar question, is it possible to do this with batch?

If it is possible, could you give me some light on how to do it, an example, or at least some links to read.

Grateful more than ever for the help you can give me

Re: Find data in an external database with Batch

Posted: 08 Feb 2022 19:24
by Compo
I'm sure it is possible, however, i'd advise that you do not, especially when you are not experienced with batch files.

I'd advise that you do not use your multiple secret, WMIC commands in cmd, to output in UTF-16 LE many pieces of data, then try to validate one or more using its poor implementation of 32-bit signed integers, and pattern matching within a database, then attempting to send notifications.

All of these things would be better performed using the built in PowerShell executable.

Re: Find data in an external database with Batch

Posted: 08 Feb 2022 22:22
by Squashman
Three quarters of your problem is not even batch file related. The majority of your knowledge deficit is making the DB queries to verify the data. This forum is not a DB forum. If you need help with the DB queries you will need to ask on another site.

Re: Find data in an external database with Batch

Posted: 09 Feb 2022 04:17
by einstein1969
I am a former database administrator, I used Oracle DB, I have not practiced for a long time but I can direct you. Let's try.

What database do you need to use?