Create a report with all assets, connected to one special user
Hello,
I``m new in Kace scripting and I want to create a report for a special user, with all conneted assets and I´ve no idea how to start. Can you give me a hint.
We like to know the computer (name, service tag, hardware etc.) and all the assests. I´tried to use the report assist, but i failed. For the sql version my knowledge is to bad.
Answers (1)
Try this report code
Select
DISTINCTUSER.USER_NAME,
ASSET_TYPE.NAME asASSET_TYPE,
ASSET_CLASS.NAMEas SUB_TYPE,
ASSET.NAME,
as1.NAME AsLOCATION
From
(ASSET ASSET InnerJoin
ASSET_TYPEASSET_TYPE On ASSET.ASSET_TYPE_ID = ASSET_TYPE.ID) Inner Join
USER USER OnASSET.OWNER_ID = USER.ID Inner Join
ASSET as1 Onas1.ID = ASSET.LOCATION_ID
LEFT JOINORG1.ASSET_CLASS ASSET_CLASS
ON(ASSET.ASSET_CLASS_ID = ASSET_CLASS.ID)
WHERE ((ASSET.ASSET_TYPE_ID = 5)
OR (ASSET.ASSET_TYPE_ID = 10201)
OR (ASSET.ASSET_TYPE_ID = 10204)
OR (ASSET.ASSET_TYPE_ID = 10202)
OR (ASSET.ASSET_TYPE_ID = 10206)
OR (ASSET.ASSET_TYPE_ID = 10207)
OR (ASSET.ASSET_TYPE_ID = 10208)
OR (ASSET.ASSET_TYPE_ID = 10209)
OR (ASSET.ASSET_TYPE_ID = 10217)
OR (ASSET.ASSET_TYPE_ID = 10219)
OR (ASSET.ASSET_TYPE_ID = 10222))
Order By
USER.USER_NAME,ASSET_TYPE.NAME,LOCATION
You will need to make sure you haver every possible asset type added in, so that's the lines starting OR (ASSET in the WHERE Statement and if you want to run this for only a sibngle user then you will also need to add to the WHERE statement to include something like WHERE USER.USER_NAME = "John Smith"