AutoIT and SQL help
I'm working on a program to manually install software to machines via BITS and as part of it, I want the program to scan active dir for all computers (have done that bit) but then want it to put all those computer names into a SQL DB under a "machines" table.
Then, when you go to install a bit of software, it will update the DB to reflect what machine had what software installed.
The idea is that next time you run the program, if you were to try and install the software to the same pc it would see from the DB it's already done.
would anyone be able to help me work on this? basically it would be:
1) start program
2) program scans AD and puts all computer names it finds into temp array (done)
3) that list of machines is added to a SQL DB table
3a) if run a second time it will add new machines, delete ones not there anymore and leave the rest
4) you go to install (for eg) smartboard.msi it will add "Smartboard" to another table of the DB
5) a third table will tie the two results in. so it will show PC1 had smartboard installed
6) next time you run the software, you can click a button which shows what is installed where and it will read the third table and show accordingly
PC1 has Smartboard installed - installed on DD/MM/YY
nice and simple, see :)
MSSQL/MySQL/SQLite? :) The best thing to do would be to look on the AutoIt forum for a UDF code module that interacts with your chosen database. I think AutoIt can interact with ODBC, but you'd need to ensure the workstation has the necessary ODBC driver installed for your database engine.
i've had a look and there are MySQL/SQLite UDFs but not sure how maintained they are.
That part will be fairly easy, it's the actual coding of it and the logistics of it I'm trying to work out!
It sounds like you need two programs - one to maintain the list of AD machines in the DB, and the other to install software and update the DB accordingly.
Try and flowchart how you want it to work (your list above is a good start!), and then work out what functions you'll need to code up to produce that one bit of functionality.
One way to get a fresh list of machines from AD into the DB, is to just empty the machines table each time. This saves a lot of checking for consistency and is one less area of complexity you have to worry about. As long as you use machine names as keys when referencing software installs, it should be fine.
right so for refreshing lists it could just be a case of
- get list
- if table exists drop table
- import list to table (repeat on every run)
i know how i want it to work, but the problem is putting it into words on here to describe to others. the closest i can explain would be similar to how the RM console software overview works. it will show a list of software, list of machines and say whats installed where. but not in a grid view and not having to constantly update
Don't use computer names, it breaks if you: a) Zap from AD then rebuild/reimage a computer with the same name, b) Rename a computer. I would use computer SIDs instead and (ephemerally) translate those to names whenever I needed to display them.