Hello All,
I would like to give you a trick to export a report from SEPM.
While exporting the reports the reports gets saved in .txt format we need to change that to .csv
save it, open with excel and here lot of columns but we are interested in just few say , computername, ip address, virus defs, infected or not.
If I need just four of the above, then I need to follow the above said procedure - delete all unnecessary columns and then get the required data.
The above said procedure is simple if we need to create a report once a month. But what if i need to create the same kind of reports everday and send it to my Boss?
Here is the trick to get customized reports and save time.
Before you procede with the trick ,please take a back up of export_inventory.php under
C:\Program Files\Symantec\Symantec Endpoint Protection Manager\Inetpub\Reporting\Inventory
copy it in a safe place, if anything goes wrong we just need to replace the original file.
when you click on the export, SEPM queries the export_inventory.php file which is under
C:\Program Files\Symantec\Symantec Endpoint Protection Manager\Inetpub\Reporting\Inventory
This is the file which tells SEPM what to query in the DB and what type the output should be.
Files inside Reporting folder are ready only , so to edit these file we need to uncheck the read only option so that we can make some changes to it.
Right click on export_Inventory.php and click on properties and uncheck read only.
Open the file with a notepad
now look for the below line
$be->start("computer_status_export.txt");
the line says that by default it will export the reports to .txt format, since we are interested in .csv
we need to change the extension, once changed the line would look like
$be->start("computer_status_export.csv");
Hereafter the output format will always come in .csv format by default
Now for the customized report we need to select the Data fields
below the
$be->start("computer_status_export.csv");
you will find $data value
just delete or comment whatever you dont need and keep the onces you require (use // to comment a line the entire line will be ignored)
For example I need computername, ip address, virus defs, infected or not
so the values in the data fields would be
$data =
$sep.I18nInventory::translateInventory("COLUMN_COMPUTER_DOMAIN_NAME").
$sep.I18nInventory::translateInventory("COLUMN_IP_ADDR1").
$sep.I18nInventory::translateInventory("COLUMN_PATTERNDATE").
$sep.I18nInventory::translateInventory("COLUMN_INFECTED")."\r\n";
$data = str_replace( array("\n","\r") , "" , $data )."\r\n";
$be->addData(from_html_entities($data));
=============================================================
Now we have selected the Colums of our interest.We need to insert data inside these colums. The data value is inserted by $string. function.
use // to comment a line these lines will be ignored by the query.
Do not comment these lines because all the query are inside a while function.
NOT TO COMMENT
while ($zeile = sav_fetch_array($result)) {
$zeile=fromHtml($zeile);
$string =
COMMENT ALL THE IF STATEMENTS BELOW $string=
for the above 4 columns I would comment everything leaving these four indide the $string .fuction Note that computer name, ip address, patterndate, column infected are in order, if you change the sequence data will swapped so keep these lines in order.the order should match with $data value
=============================================================
$sep.$zeile["COMPUTER_DOMAIN_NAME"].
$sep.$zeile["IP_ADDRESS"].
$sep.$zeile["PATTERNDATE1"].
$sep.yesorno($zeile["INFECTED"]);
$data = str_replace( array("\n","\r") , "" , $string )."\r\n";
$be->addData($data);
Thats it, !!! we are good to go now, save the file try to export a report the type will be .csv automatically with only 4 fields as mentioned above
Hope this was helpful, I have attached a modified export_inventory.txt file so that you can check what lines to be commented and what not.