/build/static/layout/Breadcrumb_cap_w.png

Scripting Question


Trouble using labels to script software install (Adobe Flash Player NPAPI)

08/22/2018 1037 views
I have several smart labels for different versions of Adobe Flash Player NPAPI setup as such:

Software Titles contains NPAPI AND
Software Version = 30.0.0.134

These appear fine. I then have a smart label setup like:

Domain contains labs AND
    Label Names = Adobe Flash Player 30.0.0.134 NPAPI OR
    Label Names = Adobe Flash Player 30.0.0.113 NPAPI OR
    Label Names = Adobe Flash Player 29 NPAPI OR
    Label Names = Adobe Flash Player 28 NPAPI OR

Lastly, I have a label restricted to Device Inventory that shows a very small number of Computers, the smart label shown above, and a script that is set to upgrade Adobe Flash Player NPAPI plugin to current version.

When I look at each of the smart labels individually, they appear to be fine. The number of machines that shows as needing the update is very small, though if I add up the number showing in each of the labels, it is much, much higher. Any idea on where I'm going wrong?
Answer Summary:
1 Comment   [ + ] Show comment

Comments

  • Where are you looking to see the number of machines that show as needing the update?
    • When I go to Home-> Label Management -> Labels, I see in the Devices column the number of devices reporting in for each of my Flash Player labels. That gives me an overall number. When I look at my label that ties it all together in that view, I see a very small amount of machines (45). When I click on that label, at the bottom of the screen I see Computers = 45, the assigned script that runs the update, and the associated smart label. If I click on the smart label here, then click to open in smart label wizard, I see 1083 machines listed. That is the number that I believe actually need the update ran. This is where I am confused as to what is going on and where the disconnect lies. I really need to get this update installed on these machines.

Answer Chosen by the Author

3
For many years I fought the battle to keep Flash Player up to date on all of my computers, and for many years I lost. Eventually I gave up and laid down my weapons at the feet of my enemy and agreed to their terms of my surrender. I swallowed the bitter pill of automatic software updates from Adobe for their hideous invention. But my foe appears to be vanquished and I am now tasting the sweet joy of their demise as the web moves away from Flash enabled content. Victory at last, victory at last.

Anyway...

Rather than assigning all of those labels, I was able to create a smart label that identifies machines not running the most recent version of Flash Player. It relies on a trick that is possible with Flash because its version numbers have four sets of numbers, much like an IP address. MySQL has a function INET_ATON which allows sorting IP addresses by those individual numbers (so 172.0.0.2 comes after 172.0.0.10, like it should). 

Using that trick you can find the highest version of Flash Player with this query:
SELECT DISPLAY_VERSION
FROM ORG1.SOFTWARE WHERE DISPLAY_NAME like "%Flash%NPAPI%"
ORDER BY INET_ATON(DISPLAY_VERSION) DESC
LIMIT 1
This does assume that the last set of numbers doesn't exceed 255, which it rarely does (20.0.0.286 and 20.0.0.306).

Armed with that trick we can make a smart label that finds computers that don't have that version.
Step 1: Create a smart label using the wizard. It doesn't matter what the criteria are, we're just going to replace them. I used Software Title contains Flash Player.
Step 2: Edit the smart label.
Browse to Home, Label Management, Smart Labels
Open the label you just created
Click the Edit SQL button
Replace the SQL there with this code:
SELECT MACHINE.NAME AS SYSTEM_NAME, SYSTEM_DESCRIPTION, MACHINE.IP, MACHINE.MAC, MACHINE.ID as TOPIC_ID FROM MACHINE  
JOIN MACHINE_SOFTWARE_JT on MACHINE_SOFTWARE_JT.MACHINE_ID = MACHINE.ID
JOIN SOFTWARE on MACHINE_SOFTWARE_JT.SOFTWARE_ID = SOFTWARE.ID and
DISPLAY_NAME like "%Flash%NPAPI%"
and DISPLAY_VERSION != (SELECT DISPLAY_VERSION
FROM ORG1.SOFTWARE WHERE DISPLAY_NAME like "%Flash%NPAPI%"
ORDER BY INET_ATON(DISPLAY_VERSION) DESC
LIMIT 1)
Now machines that don't have the highest version of Flash Player installed will automatically be labelled, and you don't even have to know what the version is! Of course, it would be nice to know that a new version is available. So here's a bonus report:
SELECT SOFTWARE.CREATED, SOFTWARE.DISPLAY_NAME, SOFTWARE.DISPLAY_VERSION, COUNT(MACHINE.ID) AS INSTALLS,
concat("https://kace.yoursite.tld/adminui/software.php?ID=",SOFTWARE.ID) AS LINK
FROM ORG1.SOFTWARE
JOIN MACHINE_SOFTWARE_JT on SOFTWARE.ID = MACHINE_SOFTWARE_JT.SOFTWARE_ID
JOIN MACHINE on MACHINE_SOFTWARE_JT.MACHINE_ID = MACHINE.ID
WHERE DISPLAY_NAME like "%Flash%NPAPI%"
AND SOFTWARE.CREATED > DATE_SUB(NOW(), INTERVAL 1 DAY)
GROUP BY SOFTWARE.ID
That will find new versions of Flash Player NPAPI that have been installed in the past day. Schedule that report to run every morning and when a new version pops up in your inventory you'll be in the know. Be sure to change the kace.yoursite.tld to your KACE URL to be able to use the handy link straight to the software title in the inventory.

Fair the well warrior!

Answered 08/23/2018 by: chucksteel
Red Belt

  • This sounds excellent! Thank you for sharing. I am not very good with SQL however, could you show me how to add the ability to that first code snippet to specify a domain? We have separate domains and I only want to target the child of one domain.
    • Sure, you need to add a statement to the where clause, or rather, you need to add a where clause since the smart label query doesn't have one.

      SELECT MACHINE.NAME AS SYSTEM_NAME, SYSTEM_DESCRIPTION, MACHINE.IP, MACHINE.MAC, MACHINE.ID as TOPIC_ID FROM MACHINE
      JOIN MACHINE_SOFTWARE_JT on MACHINE_SOFTWARE_JT.MACHINE_ID = MACHINE.ID
      JOIN SOFTWARE on MACHINE_SOFTWARE_JT.SOFTWARE_ID = SOFTWARE.ID and
      DISPLAY_NAME like "%Flash%NPAPI%"
      and DISPLAY_VERSION != (SELECT DISPLAY_VERSION
      FROM ORG1.SOFTWARE WHERE DISPLAY_NAME like "%Flash%NPAPI%"
      ORDER BY INET_ATON(DISPLAY_VERSION) DESC
      LIMIT 1)
      WHERE MACHINE.DOMAIN = "domain"
 
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