tetrauk
asked on
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
COMPUTERNAME VALIDATED for COMPANYNAME
[Blank line]
Details:
PC Unique ID: .....
[Close Button]
=====Else=====
3b) If its not already listed, It should display a red pop up as below
WARNING: VALIDATION FAILED
[Blank line]
Details:
PC Unique ID: .....
Computer Name: ......
Username:........
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
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
COMPUTERNAME VALIDATED for COMPANYNAME
[Blank line]
Details:
PC Unique ID: .....
[Close Button]
=====Else=====
3b) If its not already listed, It should display a red pop up as below
WARNING: VALIDATION FAILED
[Blank line]
Details:
PC Unique ID: .....
Computer Name: ......
Username:........
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
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. ;)
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. ;)
ASKER
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
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
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:
https://www.experts-exchange.com/questions/23184993/vbs-script-to-export-table-data-into-csv.html
For the MAC address, you can use this code:
http://www.robvanderwoude.com/vbstech_network_mac.php
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.
Regards,
Rob.
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:
https://www.experts-exchange.com/questions/23184993/vbs-script-to-export-table-data-into-csv.html
For the MAC address, you can use this code:
http://www.robvanderwoude.com/vbstech_network_mac.php
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.
Regards,
Rob.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
have resolved this myself
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