How to find the devices with certain software not installed? How can we find laptops or servers on which 'X' software is not installed using SQL query? |
The following example explains how to create a free query to find the devices with the device type 'Server' on which the application 'skype' is NOT installed. The query can be modified for one's purpose (e.g take the clause on "Server" to list all device types in the results). One more example can be found at the bottom of this knowledge article.
SELECT Devices.DeviceName from Devices WHERE Devices.DeviceType ='Server' and devices.DeviceName not in (select Devices.DeviceName from Devices LEFT outer JOIN SwInventories si ON Devices.DeviceID=si.DeviceID LEFT outer JOIN SwInvApps sa ON si.AppID=sa.AppID WHERE ((Devices.DeviceType ='Server') AND (sa.Name like '%skype%')))
The below query will list all devices:
SELECT Devices.DeviceName from Devices WHERE devices.DeviceName not in (select Devices.DeviceName from Devices LEFT outer JOIN SwInventories si ON Devices.DeviceID=si.DeviceID LEFT outer JOIN SwInvApps sa ON si.AppID=sa.AppID WHERE sa.Name='KeyView OOP APP') AND Devices.TopologyType in ('_DB_DEVTYPE_CLIENT_', '_DB_DEVTYPE_RELAY_','_DB_DEVTYPE_MASTER_') AND (Devicename like 'NB%' OR Devicename like 'PC%') AND DeviceName not in ('NGXXX1','NGXXX2'); Additionally, this KA 000115753 covers creating dynamic device groups using queries, which will be helpful in such scenarios. |