July 16, 2009 FCC Tips and Tricks (Adventures in the database)
Heads up: this tip details some messing around in the back end of our database, if you don’t know what you are doing, or even if you do please give us a quick shout before making changes to the data within. There are things that you can do back there that will be very difficult to recover from. As always, make a backup before messing around!
I’ve gotten some emails lately from people looking to do things with PS and the FCC that are not something that we traditionally support, that being said there have been a couple of items that people might find of interest that we can do in the back end.
We would like to have a way to preserve replaced computers statistics. We get new computers in the middle of the year when the lease expired to replace existing ones using the same computer name so we have to delete the computer from the database and add the new one with different MAC address. By having the old computer deleted we no longer have the statistics of power savings for that computer to be added to the report.
Because we are using a SQL back end we can actually do this by manually manipulating the names of the computers that are being decommissioned so that they appear as a different workstation than the one that replaced it. We can get away with this as we don’t use the computers name as a unique identifier in our database back end. The SQL query below will go through the FCC database and mark all the managed workstations in the database with an identifier of your choosing.
To change the marker we are using you just have to change the text between the single quotes in the SQL statement below, I’m using DECOMISSIONED right now, but you can use any valid text string.
USE FaronicsEnterpriseDatabase
UPDATE FaronicsEnterpriseDatabase.dbo.tblB6267655_C0DE_4057_B801_F9FF8612A9C9_Status
SET tblB6267655_C0DE_4057_B801_F9FF8612A9C9_Status_MachineName=(‘DECOMISSIONED ‘+tblB6267655_C0DE_4057_B801_F9FF8612A9C9_Status_MachineName)
WHERE tblB6267655_C0DE_4057_B801_F9FF8612A9C9_Status_IsDiscovered is Null
You can see the results before:
and after:
running this query on my test systems here.
Now you are probably asking why we would mark all the workstations when we may only be decommissioning a few of them. Well due to the way that our Core Agent communicates we can mark all the workstations because the computers name resets each time that the agent service is restarted (the computer is rebooted) as shown below.
Therefore the next time that a given workstation reboots it will automatically clear this flag and again display it’s proper name. The only issue with this is that you won’t be able to control the workstations that have been marked until they have rebooted as you have effectively changed the DNS name that FCC knows about and we won’t be able to connect to the workstation. You can change the method that Core Console uses to connect to rely on the IP address as opposed to the DNS name if you didn’t want to wait for the workstations to reboot (or wanted to trigger the reboot from the Core).
Next post I’ll touch on how to do filtering by the computer name using regular expressions, as it’s another trick that people have been interested in but that we admittedly don’t document all that well.
- Leave a comment
- Posted under Tech Support