Find data in an external database with Batch

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
MauricioDeAbreu
Posts: 43
Joined: 12 Dec 2021 06:45

Find data in an external database with Batch

#1 Post by MauricioDeAbreu » 08 Feb 2022 17:51

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

Compo
Posts: 600
Joined: 21 Mar 2014 08:50

Re: Find data in an external database with Batch

#2 Post by Compo » 08 Feb 2022 19:24

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.

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Find data in an external database with Batch

#3 Post by Squashman » 08 Feb 2022 22:22

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.

einstein1969
Expert
Posts: 960
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: Find data in an external database with Batch

#4 Post by einstein1969 » 09 Feb 2022 04:17

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?

Post Reply