Blog Posts by chrpetri

Ask a question

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.
View comments (1)

Detect an upgraded Windows installation with KACE K1000/SMA

Here is just a little hint for everybody that wants to know how many upgraded Windows installations are floating around the network. Especially Windows 10 installations may be upgraded "in place" to a newer build version and machines won't receive a clean install every time a new Windows 10 build (or "feature update") is released.

WindowsCentral.com posted a nice article about that and I turned it to a custom inventory field in my KACE K1000/SMA:

  1. Go to your software inventory and click the "Action" button and hit the "New" entry
    aLI9SV.jpeg
  2. Type a name for the inventory rule and be sure to select at least every Windows 10 OS build in the "Supported Operating Systems" section. You may enable every Windows version starting with Windows 7.
    A1dWgC.jpeg
  3. In the "Custom Inventory Rule" field enter
    RegistryValueReturn(HKEY_LOCAL_MACHINE\SYSTEM\Setup\Upgrade,DownlevelBuildNumber,TEXT)
  4. Save your new inventory rule and wait or force your machines to run a new inventory. You will find a value in the "Custom Inventory Fields" section under "Software", if the machine has been upgraded.
    The value shows the build number this Windows installation has been upgraded from the last time.
    If there is no value, the Windows installation was not upgraded with "in place upgrade".
    t7cGu9.jpeg
You may now use your new field in KACE reports or in Smart Labels like this:
ww9QPe.jpeg
I used "contains ." (dot) to find every machine that has been upgraded, regardless of the source build number or Windows version.

If you are interested in a blog post about how to read the full build history from your machines, let me know.


Be the first to comment

Automatically enable new Windows 10 builds in KACE K1000 SMA

Hi everybody,

since Microsoft changed its Windows lifecycle policy in Windows 10 to release a new OS build about twice a year (more information here) you may get a mix of different builds in your network inventory after some time.
Quests KACE SMA (aka K1000) recognizes every Windows 10 build as a new, independent OS in most parts of the appliance software.
That's quite helpful in some usage scenarios and in some it is not.

When I recently added a new Windows 10 1703 machine for testing purposes, it did not receive any managed installs and custom inventory rules at all - because "Microsoft Windows 10 Pro x64 (10.0.15063)" as it is called in the OS list was not enabled yet for all the software installers and custom inventory objects in our KACE SMA.
So I had to edit all these items manually and add Windows 10 1703 to the list of supported operating systems - what took quite a while.
k8xjVD.jpeg

If you (like me) don't want to do that every time a new Windows 10 build appears on your network here is way to avoid it:

Create a ticket rule that automatically adds missing Windows 10 builds to all your software installers and custom inventory rules!

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!
yfoPGT.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.
E61KMr.jpeg

3. Enter a name for the rule like "Enable missing Windows 10 builds".
Be sure the check box "Enabled" is checked if you plan to run this scheduled - if you prefer manual execution, uncheck it!
Dakfob.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:
INSERT INTO SOFTWARE_OS_JT 
SELECT
  softw.ID soID,
  ost.ID AS osID
FROM
  OPERATING_SYSTEMS ost,
  SOFTWARE softw
WHERE
  (softw.FILE_NAME <> '' OR softw.INVENTORY_RULE <> '') AND
  ost.NAME LIKE '%Windows 10 %' AND
  ost.ID NOT IN (SELECT
    softOSJT.OS_ID
  FROM
    SOFTWARE_OS_JT softOSJT
  WHERE
    softOSJT.SOFTWARE_ID = softw.ID
) AND
  ost.ID IN (SELECT
    machOS.OS_ID
  FROM
    MACHINE machOS
  GROUP BY
    machOS.OS_ID
) AND
  softw.ID IN (SELECT
    softOSJT.SOFTWARE_ID
  FROM
    SOFTWARE_OS_JT softOSJT
    INNER JOIN OPERATING_SYSTEMS osNAMES ON softOSJT.OS_ID = osNAMES.ID
  WHERE
    softOSJT.SOFTWARE_ID = softw.ID AND
    osNAMES.NAME LIKE '%Windows 10 %' AND
    osNAMES.ID IN
(SELECT
      machOS2.OS_ID
    FROM
      MACHINE machOS2
    GROUP BY
      machOS2.OS_ID
))

Some explanation:
Take care of software objects with file attachments (installers) or custom inventory rules
Only select OS that are not already in the list of enabled OS for this software
Only select OS that are currently present in your active inventory - we don't want abandoned builds
Only select software items that already have at least one Windows 10 build enabled and limit this list to active inventory builds as well

5. Now set your schedule in the last section below. "15 minutes" is the shortest interval to choose, I personally run this once every hour. 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!
FVw9rE.jpeg

That's it! 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 newly inserted software/OS relations and any other output of the database engine.

Enjoy!
View comments (3)

KACE SmartLabel for machines with CD/DVD-writer

Hi everybody,

here comes a quick tip for your KACE SMA (formerly known as K1000):
When I recently planned to deploy CDBurnerXP to my machines (hint: click on "more download options" on the download page to find a nice MSI for rollout!) I wondered if it would be possible to automatically deploy the software to all machines that have a CD oder DVD-writer built in.

Short answer: it is. You need two things:
1. A report that tells you which writer models you have in your network
2. A smart label to capture all machines with these writers

The report

You can create the needed report with the report wizard of your SMA. Here are the steps:

1. Start the wizard, name your report and choose topic "Device"
Hzqfvi.jpeg

2. The only field you need to display is "CD/DVD Drives" under in the "Drive Information" section
at9Gua.jpeg

3. No need for sorting, so proceed to "Sort and Breaks". Make sure you enable "Break header" behind the "CD/DVD Drives" field
VKtbUX.jpeg

4. No need for filters here, so just finish.

The SmartLabel
Next step is to run your new report to find out how your drives are named. I prefer running the report as TXT file since you can work with clever tools like Notepad++ marking feature.
As you can see in the following screenshot, all my optical drives with writer capability include the term "DVD+-RW". Lookout for these terms through all the drive models the report threw out and note them!
wBhaHb.jpeg

When you identified all relevant terms, go to your inventory and start a new smart label. Create a line with "CD/DVD Drives" "contains" "<<your term>>" for each of your terms and link them with "OR".
cZVaLP.jpeg


I'm sure you won't find more than a few different terms, these kind of drives seem to have very similar descriptions these days...



...and that's it! Now, what can you do with that? Two suggestions:

Create a managed installs with your favourite burning software:
bY4W9o.jpeg

Create a KACE script to block using the DVD writer at all (this setting is only for the integrated Windows disc burning features, it does not block 3rd party burning software!):
toL7Gh.jpeg

Be the first to comment

Show and use Windows Server roles and features in your K1000

Lately I was looking for a way to build a smart label to grab all Remote Desktop Session Hosts (formerly known as "Terminal Servers") in my K1000.
I found a solution that is working for me:

1. Custom Inventory Field

  • Build a custom inventory field in you K1000 by going to "Inventory", "Software" and then select "New" from the "Choose Action"-menu.

  • Enter a name for your field, "Server roles and features" e.g.

  • Select all operating systems that this field should be evaluated on by holding the CTRL-key and clicking each of the required entries.
    In our case it makes sense to select Windows Server OS only since the query won't work on any Windows client OS.

    In my tests I found this one works on Windows Server 2008 R2 and above.
    If you need to support Windows Server 2008 Non-R2 (but not older!), see the alternative command in the next step.

    IMPORTANT: If new Windows Server OS come into your K1000's managed device inventory make sure you come back here and enable these new server OS as well - the K1000 won't do that for you!

  • In the field "Custom Inventory Rule" enter the following:

    ShellCommandTextReturn(%windir%\SysNative\WindowsPowerShell\v1.0\powershell -NoLogo -NonInteractive -NoProfile -Command "Get-WindowsFeature | where-object {$_.Installed -eq $True} | foreach {$_.Name}")

    If you need to support Windows Server 2008 Non-R2 enter the following command INSTEAD. According to Microsoft, this query method is deprecated since Windows Server 2012 - on my 2012 and 2012 R2 servers this is working anyway.
    So here is the "old school" command:
    ShellCommandTextReturn(wmic /namespace:\\root\CIMV2:Win32_ServerFeature PATH Win32_ServerFeature Get Name)


  • After running inventory on your server(s), you should now have a custom inventory field (in the "Software" section) showing you all installed roles and features of the server.

2. Smart Label

When the custom inventory field is available and working we can use the smart label editor to build filters on that.

  • First of all, you need to identify the "core" role name(s) of the roles you are looking for. Note that a roles "Display Name" may be localized, that's why I suggest to use the "Name" field instead to make this one work on all machines.
    To find out what your roles name is open a PowerShell command line on one of your servers and run the following command:

    Get-WindowsFeature | where-object {$_.Installed -eq $True} | ft DisplayName,Name

    This will give you a list of "Name" and "DisplayName" side-by-side. In my case, I want to see the servers with "Remotedesktop-Sitzungshost" (German for the RDS Session Host) - that roles name is "RDS-RD-Server".

    If you used the "old school" command above you need to check the names listed by the WMIC command instead.

  • Now open a smart label editor in your "Inventory" "Device" overview and select your new custom inventory field from above in the list of available fields.
    Switch the operator to "contains" and enter your desired role name in the right field.

    uzIjDT.jpeg

    Test your label configuration. If everything is OK, enter a name for your smart label, hit "Save" - and you're done!

    You can also define combinations, e.g. "contains RDS-RD-Server AND contains RDS-Web-Access" to find your RemoteApp host etc.

  • Wait for the next inventory to run to see your label getting populated!

Another nice idea to use this field is in reports. You could create a report that shows all servers having the role "Desktop-Experience" installed or not having .NET-Framework 3.5 installed (choose "does not contain" as operator and "NET-Framework-Features" as role name!)


If you want to use this for your client machines, please note the PowerShell query is different. We need to use the Win32_OptionalFeature-class here. The PowerShell command would be

Get-WmiObject -query 'select * from win32_optionalfeature where installstate=1' | foreach {$_.Name}

then, so you could use the following custom inventory command:

ShellCommandTextReturn(%windir%\System32\WindowsPowerShell\v1.0\powershell -NoLogo -NonInteractive -NoProfile -Command "Get-WmiObject -query 'select * from win32_optionalfeature where installstate=1' | foreach {$_.Name}")
Be the first to comment
Showing 1 - 5 of 7 results

Top Contributors

Talk About K1000 SQL