Previously working uninstallation script using smart labels no longer working
I somehow stumbled into making this work about a month ago with a previous question(https://www.itninja.com/question/managed-installations-via-labels) but now I have a similar situation and can not replicate this procedure for some reason. Following the original article listed (https://support.quest.com/kb/4276707) I was able to create a report that finds all devices with a specific software installed. I have created an uninstall script and manually entered in a device in the device list and the script worked and did exactly what I wanted. I can not however seem to figure out how to add the list of devices found via the SQL report to the list of devices to run the script on. It seems to reference the report can be used as a smart label, however I dont see it under the list of smart labels, and attempting to create a smart label via the wizard only found about a quarter of the devices it should, and when attempting to run the script with that smart label associated with didnt give any errors but also didnt uninstall the software. tl:dr how do I get a script to run on devices found in a sql report generated via this method (https://support.quest.com/kb/4276707)?
Answers (2)
You need to take the report SQL, check that DEVICE.ID is the first column selected in the report.
You can then copy the SQL to use in a smart label.
If you create a simple device smart label using the wizard, then open up the smart label and view the SQL. Then paste in your report copied SQL and you should be good to go.
Remember smart labels only populate when devices check in, so find a device that should be included and force it to report inventory.
My SQL is entry level at best and Im not familar with the naming convention of tables and data in KACE. It did not have any call to DEVICE.ID and tried to add it, but I got an error saying unknown column. Is there a place to look at the column names to make sure I enter the right thing? Below is my full SQL report with the (incorrect) addition of the DEVICE.ID.
select
DEVICE.ID as DEVICE_ID,
S.DISPLAY_NAME as SOFTWARE_NAME,
S.DISPLAY_VERSION as VERSION,
M.NAME as MACHINE_NAME,
M.USER_FULLNAME as LAST_USER
from
SOFTWARE S
left join
MACHINE_SOFTWARE_JT MSJ ON S.ID = MSJ.SOFTWARE_ID
left join
MACHINE M ON MSJ.MACHINE_ID = M.ID
where
S.DISPLAY_NAME like 'ThinPrint Client Windows 11'
and not IS_PATCH and NOT M.NAME like ''
order by S.DISPLAY_NAME , S.DISPLAY_VERSION , M.NAME