Video Screencast Help
Search Video Help Close Back
to help
New in the Rewards Catalog: Vouchers for "Symantec Technical Specialist" and "Symantec Certified Specialist" exams.

Trick to export customized reports from Symantec endpoint Manager

Updated: 25 Nov 2009 | 10 comments
Rafeeq's picture
+10 10 Votes
Login to vote

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.

 

 

Comments

Vikram Kumar-SAV to SEP's picture
25
Nov
2009
0 Votes 0
Login to vote
Ovid's picture
26
Nov
2009
0 Votes 0
Login to vote

Customising the reports ....

Good one .. 

Just A thought :

How about  Creating a batch file to make changes in the Xcel sheet rather than changing the PHP ,because if in case you need full report later you have to change the PHP inventory file again manually .

Rafeeq's picture
26
Nov
2009
0 Votes 0
Login to vote

Hi

@Prashant working on that will update you soon, thanks for the input.

Please don't forget to mark your thread solved with whatever answer helped you : ) Rafeeq

AravindKM's picture
03
Dec
2009
0 Votes 0
Login to vote

Nice information.. 

Nice information.. 

Please don't forget to mark your thread solved with whatever answer helped you : ) Thanks & Regards Aravind

Fatih Teke's picture
09
Dec
2009
0 Votes 0
Login to vote

good trics

thank you for good tricks

 Everything works better when everything works together.

Subhani's picture
04
Jan
2010
1 Vote +1
Login to vote

Thanks Rafeeq. I tried this

Thanks Rafeeq. I tried this but it somehow did not work for me . I do get the required data but I also get some repeated data which keeps on decreasing itself in a loop .I have matched my PHP file with your file and every thing is same except that I have asked for few more colums but it is not working .Let me know how can I upload  my file and the resultant reply if you want to check.

Ajit Jha's picture
24
Feb
2010
0 Votes 0
Login to vote

Really a good one. Had no

Really a good one. Had no idea we could do this

Regards'

Ajit Jha

Technical Consultant

STS

MadTheory's picture
19
May
2010
1 Vote +1
Login to vote

Great find.  It has helped me

Great find.  It has helped me save alot of time.  Two things I want to add:

With the release of 11.0.6, the syntax has change slightly:

Instead of  $be->start("computer_status_export.txt");
it looks like
$be->start(rawurlencode(I18nInventory::translateInventory("COMPUTER_STATUS_EXPORT")).".txt");

Changing txt to csv has the same effect though.

Also I would like to add that you can do the same thing with the Firewall logs.

Program Files\Symantec\Symantec Endpoint Protection Manager\Inetpub\Reporting\Firewall\export_firewall.php is the file to edit.
$be->start(rawurlencode(I18nFirewall::translateFirewall("FIREWALL_REPORT")).".txt"); is the line to edit.

mon_raralio's picture
23
Sep
2010
0 Votes 0
Login to vote

Request for code...

Is it possible to change the separator symbol from a comma to something else. Like a semi-colon.

“Your most unhappy customers are your greatest source of learning.”

Jack_B's picture
16
Dec
2010
1 Vote +1
Login to vote

seperator semi-colon

mon_raralio, search in export_inventory.php for string "sep".

You'll find:

 

$sep = ",";

 

Just change the line to:

 

$sep = ";";