Video Screencast Help
Scheduled Maintenance: Symantec Connect is scheduled to be down Saturday, April 19 from 10am to 2pm Pacific Standard Time (GMT: 5pm to 9pm) for server migration and upgrades.
Please accept our apologies in advance for any inconvenience this might cause.

Trick to export customized reports from Symantec endpoint Manager

Created: 25 Nov 2009 • Updated: 25 Nov 2009 | 10 comments
Language Translations
Rafeeq's picture
+13 13 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 10 CommentsJump to latest comment

Vikram Kumar-SAV to SEP's picture

 Great Finding !!!

Vikram Kumar

Symantec Consultant

The most helpful part of entire Symantec connect is the Search button..do use it.

0
Login to vote
Prashant Nair's picture

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 .

Regards

Prashant 

 

 

We are the difference between vulnerable and protected.

 

 

0
Login to vote
Rafeeq's picture

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

0
Login to vote
AravindKM's picture

Nice information.. 

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

0
Login to vote
Fatih Teke's picture

thank you for good tricks

 Everything works better when everything works together.

0
Login to vote
Subhani's picture

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.

+1
Login to vote
Ajit Jha's picture

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

Regard's

Ajit Jha

Technical Consultant

ASC & STS

0
Login to vote
MadTheory's picture

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.

+1
Login to vote
mon_raralio's picture

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.”

0
Login to vote
Jack_B's picture

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

You'll find:

 

$sep = ",";

 

Just change the line to:

 

$sep = ";";

+1
Login to vote