→ 🚀What's New? Join Us for the Fall Product Launch! Register Now !
‎01-05-2018 05:00 PM
‎01-08-2018 07:43 PM
SELECT Distinct Name
FROM tblUSBDevices
WHERE Name LIKE '%keyboard%'
SELECT Distinct Name
FROM tblUSBDevices
WHERE Name LIKE '%mouse%'
Select Top 1000000
tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Lastseen,
tblAssets.Lasttried,
CASE
WHEN EXISTS (SELECT Top 1
FROM tblUSBDevices
WHERE
tblUSBDevices.AssetID = tblAssets.AssetID
AND ( tblUSBDevices.Name = 'HID Keyboard Device'
OR tblUSBDevices.Name = 'Microsoft Hardware USB Keyboard'
OR tblUSBDevices.Name = 'Designer Keyboard'
)
)
THEN 'USB Keyboard'
ELSE ''
END AS USBKeyboard,
CASE
WHEN EXISTS (SELECT Top 1
FROM tblUSBDevices
WHERE
tblUSBDevices.AssetID = tblAssets.AssetID
AND ( tblUSBDevices.Name = 'HID-compliant mouse'
OR tblUSBDevices.Name = 'Lenovo Optical Mouse (HID)'
OR tblUSBDevices.Name = 'Microsoft Hardware USB mouse'
OR tblUSBDevices.Name = 'Microsoft USB Wheel Mouse Optical'
OR tblUSBDevices.Name LIKE 'Microsoft USB Basic Optical Mouse%'
)
)
THEN 'USB Mouse'
ELSE ''
END AS USBMouse,
CASE
WHEN EXISTS (SELECT Top 1
FROM tblPortConnector
WHERE
tblPortConnector.AssetID = tblAssets.AssetID
AND tblPortConnector.ConnectorType LIKE '%61%'
AND tblPortConnector.PortType = 13
)
THEN 'PS/2 Keyboard Port'
ELSE ''
END AS PS2KeyboardPort,
CASE
WHEN EXISTS (SELECT Top 1
FROM tblPortConnector
WHERE
tblPortConnector.AssetID = tblAssets.AssetID
AND tblPortConnector.ConnectorType LIKE '%61%'
AND tblPortConnector.PortType = 14
)
THEN 'PS/2 Mouse Port'
ELSE ''
END AS PS2MousePort
From
tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Where
tblAssetCustom.State = 1
AND tblAssets.AssetType=-1
Select Top 1000000
tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Lastseen,
tblAssets.Lasttried,
CASE
WHEN EXISTS (SELECT Top 1
FROM tblUSBDevices
WHERE
tblUSBDevices.AssetID = tblAssets.AssetID
AND ( tblUSBDevices.Name = 'HID Keyboard Device'
OR tblUSBDevices.Name = 'Microsoft Hardware USB Keyboard'
OR tblUSBDevices.Name = 'Designer Keyboard'
)
)
THEN 'USB Keyboard'
ELSE ''
END AS USBKeyboard,
CASE
WHEN EXISTS (SELECT Top 1
FROM tblUSBDevices
WHERE
tblUSBDevices.AssetID = tblAssets.AssetID
AND ( tblUSBDevices.Name = 'HID-compliant mouse'
OR tblUSBDevices.Name = 'Lenovo Optical Mouse (HID)'
OR tblUSBDevices.Name = 'Microsoft Hardware USB mouse'
OR tblUSBDevices.Name = 'Microsoft USB Wheel Mouse Optical'
OR tblUSBDevices.Name LIKE 'Microsoft USB Basic Optical Mouse%'
)
)
THEN 'USB Mouse'
ELSE ''
END AS USBMouse,
CASE
WHEN EXISTS (SELECT Top 1
FROM tblPortConnector
WHERE
tblPortConnector.AssetID = tblAssets.AssetID
AND tblPortConnector.ConnectorType LIKE '%61%'
AND tblPortConnector.PortType = 13
)
THEN 'PS/2 Keyboard Port'
ELSE ''
END AS PS2KeyboardPort,
CASE
WHEN EXISTS (SELECT Top 1
FROM tblPortConnector
WHERE
tblPortConnector.AssetID = tblAssets.AssetID
AND tblPortConnector.ConnectorType LIKE '%61%'
AND tblPortConnector.PortType = 14
)
THEN 'PS/2 Mouse Port'
ELSE ''
END AS PS2MousePort
From
tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Where
tblAssetCustom.State = 1
AND tblAssets.AssetType=-1
AND NOT (EXISTS (SELECT Top 1
FROM tblUSBDevices
WHERE
tblUSBDevices.AssetID = tblAssets.AssetID
AND ( tblUSBDevices.Name = 'HID Keyboard Device'
OR tblUSBDevices.Name = 'Microsoft Hardware USB Keyboard'
OR tblUSBDevices.Name = 'Designer Keyboard'
)
)
AND EXISTS (SELECT Top 1
FROM tblUSBDevices
WHERE
tblUSBDevices.AssetID = tblAssets.AssetID
AND ( tblUSBDevices.Name = 'HID-compliant mouse'
OR tblUSBDevices.Name = 'Lenovo Optical Mouse (HID)'
OR tblUSBDevices.Name = 'Microsoft Hardware USB mouse'
OR tblUSBDevices.Name = 'Microsoft USB Wheel Mouse Optical'
OR tblUSBDevices.Name LIKE 'Microsoft USB Basic Optical Mouse%'
)
)
)
AND (EXISTS (SELECT Top 1
FROM tblPortConnector
WHERE
tblPortConnector.AssetID = tblAssets.AssetID
AND tblPortConnector.ConnectorType LIKE '%61%'
AND tblPortConnector.PortType = 13
)
OR EXISTS (SELECT Top 1
FROM tblPortConnector
WHERE
tblPortConnector.AssetID = tblAssets.AssetID
AND tblPortConnector.ConnectorType LIKE '%61%'
AND tblPortConnector.PortType = 14
)
)
‎01-08-2018 09:49 AM
‎01-05-2018 05:17 PM
‎01-05-2018 05:07 PM
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now