Hi Ayaz,
CLW historical query won't work for the metric in question "Agent Stats:Build and Release" because it's a String metric and don't get stored in Smartstor, can only be viewed in live mode.
Here is a way to accomplish what you want although will require use of Report Templates
Step 1- Create a metric grouping which matches on "Agent\ Stats:Build\ and\ Release" for required agents
Step 2- Create a new Report Template for e.g called as Test and add a Metric Data Table as an element
Step 3- In the right hand side in Data Properties tab chose the above Metric Grouping created
Step 4(Most Important)- In Display Properties tab scroll to the "Table Columns:" and choose "Text Value"
Step 5- Save Report template, enable and preview it to make sure that the required Build and Release information is present
Step 6- Run below command using CLW to generate the report and save it locally for e.g
generate report named "Test" in management module named "<Name of MM containing Report Template>" to <filename>.pdf
Regards,
Kulbir.