/build/static/layout/Breadcrumb_cap_w.png

Automatically (re)name your KACE K1000/SMA assets from a barcode

I like the K1000/SMAs newly introduced feature of handling barcodes with assets using the "KACE GO"-App a lot.
When we get new mobile devices for our company we record them as assets in our KACE SMA.
Now I can create a new asset from the KACE GO app by scanning the mobile devices IMEI from the barcode on the retail box and saving the data directly to the KACE appliance.

But you can't automatically name the new asset after the barcode value, so in my case the IMEI number.
For every new asset, we had to copy/paste the barcode value of the IMEI to the Name-field of the asset after creation and save it again.

Today I figured out how this can be automated.

A prerequisite: your desired asset type needs to have a barcode field exactly named "Name", whose value will be assigned as the asset name then.
You may have to add that barcode field in the Asset Type Configuration dialogue:
dxHy81.jpeg

Then, like in "Automatically enable new Windows 10 builds in KACE K1000 SMA", we will create a ticket rule for this.

Note: the following instructions are provided without any warranty, make backups, test carefully and use this at your own risk!

  1. Go to "Configuration" section of your Service Desk module and to the "Rules" then
    Hint: you can create ticket rules like this even if you normally do not use the service desk module!
    y6vKSc.jpeg
  2. If you want, switch to the service desk queue where you want to create the rule in - but it does not really matter which one it is since this one does not change any tickets at all. In this example we stay in the default queue.
    Now hit the "Choose action" button and select "New (SQL)" then.
    D1u67i.jpeg
  3. Enter a name for the rule like "Update Asset Name from Barcode Name value".
    Check the box "Enabled" since we plan to run this scheduled. But you might want to run the rule manually until you fully tested this one.
    NC3arL.jpeg
    In the "Select SQL" section, write this:
    SELECT 1 AS 'HD_TICKET.ID'
  4. Leave all the following options unchecked except "Run update query". In this box, enter this:
    UPDATE ASSET ast
      INNER JOIN ASSET_BARCODE_JT abJT ON ast.ID = abJT.ASSET_ID
      INNER JOIN BARCODE bc ON bc.ID = abJT.BARCODE_ID
    SET ast.NAME = bc.BARCODE_DATA
    WHERE
      bc.BARCODE_DATA <> ast.NAME AND
      bc.BARCODE_DATA <> '' AND
      bc.BARCODE_NAME = 'Name'

  5. Now set your schedule in the last section below. "15 minutes" is the shortest interval to choose. I prefer this value for this scenario since I want to have my assets named correctly as soon as possible. This query should not cause much impact on your appliance database performance, but you should test this in your environment.
    If you prefer to run this manually, leave the "Schedule" section and disable the rule. You can still run it by hitting the "Run Now" button on demand.
    Don't forget to save your work by hitting the "Save" button!
    EpXu2Y.jpeg
We're done! Carefully test this (make a backup!!), the "Last run log" section in the ticket rule editor shows you the last query results with a number of all the updated records and any other output of the database engine.

Since we are now working with this method to name the new assets we slightly changed the process of creating new assets from the KACE GO-App: we now giving the new assets a bogus name (like '123') since we are required to provide a name before we can save the asset to the database at all.
The ticket rule now renames the new asset(s) in 15 minutes at the latest!
A small tear drop: the rename action from the ticket rule will NOT be recorded in the asset history.

If  I can answer any questions about this just leave a comment below.

Comments

  • Or check out our tool which does all of that without the hassle and hard work http://www.itninja.com/blog/view/barkode-v3-1-released-consumables-management-and-audit-capability - Hobbsy 6 years ago
  • OK, this works but I've tweaked it as i want to add the Name field in as a QR bar-code as that's our asset tagging and naming convention for devices. Issue i have is that this code overwrites any bar-codes currently on the row so it overwrites the dell service tag bar-code. how do i append a bar-code without overwriting the existing ones. They have unique IDs but i need to run this on over 4000 rows so would like it to create a unique ID. Any pointers? - JCKACE 6 years ago
  • Code used:
    UPDATE ASSET ast
    INNER JOIN ASSET_BARCODE_JT abJT ON ast.ID = abJT.ASSET_ID
    INNER JOIN BARCODE bc ON bc.ID = abJT.BARCODE_ID
    SET bc.BARCODE_DATA = ast.NAME, bc.BARCODE_FORMAT = "QR", bc.BARCODE_NAME = "QR TAG"
    WHERE
    ast.NAME = "JCxxxxxx" AND
    bc.BARCODE_DATA <> ast.NAME AND
    ast.NAME <> '' - JCKACE 6 years ago
    • I need to be sure that I fully understand your situation:
      You have your assets named the way you want and now you want to set a barcode-field named "QR TAG" to the assets name?
      Does the "QR TAG" barcode field already exist for every asset targeted? - chrpetri 6 years ago
    • So I think your query needs to update the BARCODE_DATA table instead of the ASSET table.
      You may try this one (always make a backup before you try):

      UPDATE BARCODE bc
      INNER JOIN ASSET_BARCODE_JT abJT ON abJT.BARCODE_ID = bc.ID
      INNER JOIN ASSET ast ON ast.ID = abJT.ASSET_ID
      SET bc.BARCODE_DATA = ast.NAME
      WHERE
      ast.NAME LIKE 'JC______' AND
      bc.BARCODE_DATA <> ast.NAME AND
      ast.NAME <> '' AND
      bc.BARCODE_FORMAT = 'QR' AND
      bc.BARCODE_NAME = 'QR TAG'

      This should limit the update to barcode fields with linked assets whose name starts with "JC" followed by 6 characters (since you wrote "JCxxxxxx"). - chrpetri 6 years ago
  • Yes the QR TAG exists in BARCODE.BARCODE_NAME. - JCKACE 6 years ago
  • I have managed to get round this issue as inventory from the agent re-populates the dell tag code when it checks in but for some reason i can only update computer assets. I have 2 other asset_type_id values that return 0 rows updated. - JCKACE 6 years ago
  • 30/01/2018 11:07:00> Starting: 30/01/2018 11:07:00 30/01/2018 11:07:00> Executing Select Query... 30/01/2018 11:07:00> selected 2517 rows 30/01/2018 11:07:00> Executing Update Query... 30/01/2018 11:07:00> updated 0 rows 30/01/2018 11:07:00> Ending: 30/01/2018 11:07:00 - JCKACE 6 years ago
This post is locked
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ