One of the things that are hard to figure out or process in the KBOX 1000 is the MIA section under the Inventory tab.
If you are not familiar with this tab, it is essentially a listing of all workstations that have not checked in within a particular period of time. This list can be sorted by the number of syncs missed, or by the number of days that machine has been offline.
The KBOX does a great job listing those. Some would argue that it is easy to just select everything and delete them from the list, and wait for them to recheck in. The dilemma with this, is the question: How do you know whether a machine is offline for good (been re-imaged, but not removed from the inventory and now has a duplicate inventory item, decommissioned and not removed from inventory), or the machine is online, but has its agent malfunctioning, and therefore not checking in like it is supposed to.
I initially found myself going through the list of MIA machines, and performing a ping on them to see if they’re online. More often than not, they were actually offline. However, there are cases, where some machines were supposed to be online, but aren’t. In my case, I have a list of 1580 workstations in the MIA section. Doing this manually would take my a couple of days to sort through. I ended up initially writing a script to process these machines, but I still had a problem: getting the listing of computers from the KBOX MIA inventory item into a text file to process it.
The method still involved connecting to MySQL and performing a query. So I decided to integrate that query into the script. Unfortunately, there are a couple of dependencies required for this, namely, KIX scripting engine (because this is what I’m pretty familiar with), ODBC 3.51 driver, and psexec. The necessary links to download those are within the script itself.
All you have to do with this script is set the configuration to match your environment
Username: specify the username to connect to your KBOX database. Typically ORG1 DB
Password: the password to use to connect to the database.
Days: the number of days that you would like to go back in time for checking on the MIA workstations.
Action: the action you would like to perform on machines that have been found to be online. Possible actions for this are:
- Restart: will restart the AMP agent –> Ampreset.exe
- Checkin: will force a checking of the workstation –> KBScriptrunner.exe
- Test: will not perform any action on a machine that is online, but merely state whether it is online.
This is not fool proof, and if there are workstations in your domain that your currently logged is user doesn’t work under, you may have to pass on some credentials to the psexec.exe command.
I have written this as a quick and dirty way to deal with a process that I couldn’t find natively in the KBOX, so the script is by no means complete, but does the job for the most part.
If you are interested in a slightly more developed version of this script, please let me know in the comments, and I will work on that.
Below is the script:
It is worth noting that a slight change in the script will likely be required when version 5.3 comes out. In addition, I have no way of knowing whether 5.3 will contain something to fix this problem altogether, but until then, this should do it.