• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 739
  • Last Modified:

Script to Validate PC

I'm looking to find a way to validate Computers by running a .bat or .vbs or similar file on them.

To start with there will be a MySQL table on a web server with the following columns
Unique ID, Company Name, Date, Time, ComputerName, LastUserName

The script should:

1) Generate a Unique ID, Preferably from something hardware so even is the OS is reinstalled it will still validate. It should be the same every time its generated from that computer.

2) Query an SQL server to find out if that Unique ID is already listed in table.

3a) If its already listed, It should update the record with the current Date, Time, ComputerName and Current UserName

4a) It should display a green pop up as below

[Blank line]
PC Unique ID: .....
[Close Button]


3b) If its not already listed, It should display a red pop up as below
[Blank line]
PC Unique ID: .....
Computer Name: ......

Authorise This PC:
Password: [Password entry box]
Company Name: [Plain Text Entry Box]
[Close Button]

4b) Assuming the password is correct the Unique ID, Company Name, Date, Time, Computer Name and Current UserName should be entered into the MySQL database. the program should loop back to the start to validate the computer against the database (this should now be fine)

Any idea, how to make this? or who we should talk to in order to get it made?
I cant see the code being particularly complex as scripts go, I'm fairly adaptable so if you point me towards the correct resources that I can cut,edit,mix and match from I would hopefully be able to create it myself.

Thanks a Great Deal
1 Solution
One part: The MAC address of the network interface suggests itself as identifier.
For the rest I suggest a web-based form. For example, this allows arbitrary client operating systems, you just need a browser.
IF the web server is in the same LAN as the client, it can determine the client's MAC by itself. However, you'd need to pull the username and computername environment variables - see here for example for hints applicable to Windows: http://hardforum.com/showthread.php?t=1099819
Todd GerbertIT ConsultantCommented:
I agree with thehagman's comment above. I would only add that - assuming you're in a PC-only Active Directory environment, and you are the administrator - it seems like either a computer startup script (written in either JavaScript or VBScript), or a user login script, assigned via Group Policy would be the way to go.

You shouldn't have too much trouble coming up with a simple script that connects to a SQL server - there are more than enough examples available everywhere you look.

(Incidentally - your question kind of reads like you expect to provide us with a list of project requirements, and expect a completed piece of work, though I realize that may not have been your intention. Nevertheless, I'm more than happy to help, teach, or advise - but I have no intentions on doing your job for you. ;)
tetraukAuthor Commented:
tgerbert - It is actually the project spec I posted on freelancer, but I was asking here to figure out if I could do it myself. I'm not great at coding but will give anything a go!!!

I'm looking here more for tips on how to connect and run an sql query from vbs or bat files. How to extract a mac address or other to a variable in a bat or vbs... things like that
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Hi tetrauk,

There's code here to read data from mySQL, requiring a DLL driver, although it's a bit old, so there's probably an updated driver by now:

For the MAC address, you can use this code:

So, based on retrieving the MAC address, you could query mySQL for a matching record, and update as necessary.

If you can get working bits of code to do those two things, I can help you piece it together for the final outcome.


tetraukAuthor Commented:
Have solved this myself, used the wmic command in a bat file to get a unique id, dumped it to a variable and put it into a start iexplorer.exe http://www.xyz.com/?uid=%variable% command.
After that everything is php and mysql, I've learnt a LOT!!!
tetraukAuthor Commented:
have resolved this myself

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now