First off big shoutout to @Esben_D for his assistance in getting this working.Short Story: We are a construction company that has a bunch of printers through a printer vendor. These printers tend to move around a bit when projects finish up and start-up. The vendor is notified and moves the printers for us etc, but they seem very slow to process the updated details for site locations.
Our poor receptionist gets calls & emails from them month chasing usage counters for the printers and the locations eg if we still have them.
Thanks to Esben and Lansweeper we have this custom report that gets emailed to her monthly with the printer location/serial number and print/page counters for the reporting. Previously she was having to call around to all the sites and have a staff member on-site read out the details etc.
Why spend 10 minutes calling sites when you can spend 3x days automating it 😛 It will save time in the long term. And the 3x days was an exaggeration but a bit of IT Humor.
Note you will need to set up custom OID scanning if you want to pull this data.
The biggest issue was finding the necessary OID's for each printer. Thankfully we only use Fuji and Konica so didn't need to find too many.
Code in question
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblAssetCustom.Serialnumber,
OID1.Data As Colour,
OID2.Data As Mono,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
tblAssets.Lastseen,
Case
When tblAssets.Lastseen < GetDate() - 2 Then
'Information may not be up-to-date.'
End As Comment,
Case
When tblAssets.Lastseen < GetDate() - 2 Then '#ffadad'
When tblAssets.Lastseen > -2 Then '#d4f4be'
End As backgroundcolor
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tblAssets.Assettype = tsysAssetTypes.AssetType
Inner Join tsysIPLocations On tsysIPLocations.LocationID =
tblAssets.LocationID
Inner Join tblState On tblState.State = tblAssetCustom.State
Left Join (Select tblOIDData.OIDDataID,
tblOIDData.Data,
tblOIDData.Label,
tblOIDData.AssetID
From tblOIDData
Where tblOIDData.Label Like '%Printed Pages Colour%') As OID1 On
OID1.AssetID = tblAssets.AssetID
Left Join (Select tblOIDData.OIDDataID,
tblOIDData.Data,
tblOIDData.Label,
tblOIDData.AssetID
From tblOIDData
Where tblOIDData.Label Like '%Printed Pages Mono%') As OID2 On
OID2.AssetID = tblAssets.AssetID
Where tsysAssetTypes.AssetTypename = 'Printer' And tblState.Statename = 'Active'
Order By tblAssets.AssetName
Scanning > Custom OID Scanning > OID Scanning Targets

