Jump to content

Archived

This topic is now archived and is closed to further replies.

thepip3r

Is there a way to increase the processing priority for the PHP CLI??

Recommended Posts

I have a script that runs every 5 mins on a Windows Server 2003 OS to update a database from a variable length directory of INI files.  My problem is that when the directory gets a larger number of files, it takes a longer time for the script to process, like over an hour.  I've watch the php.exe process and while I can see it kicked off, it barely does anything to the processor so I'm wondering if there's anyway that anyone  might now as to how I might be able to speed up this batch processing request.  Thanx in advance.

Edit:  the script is writing a bunch of information to a MySQL database and the mysql process is very active compared to the PHP exe so maybe that's my downfall.  Can anyone give me any pointers on streamlining some of my code to see if there's a way to make it run more efficiently?  thanx again.

[code]$ScriptStartTime = microtime_float();
db_open();

$INIPath = "e:\\inventory_agent\\data\\INIs\\";
$ComputerCount = 1;

if (is_dir($INIPath)) {
  if ($INIDH = opendir($INIPath)) {
    while (($INIFile = readdir($INIDH)) !== false) {
  $INISub = SubStr($INIFile,-4,4);
  $HostName = SubStr($INIFile,0,StrLen($INIFile)-4);
 
  if ($INISub == '.ini') {
if (is_file($INIPath.$INIFile)) {
  $ini_array = parse_ini_file($INIPath.$INIFile, true);
          $Timestamp = $ini_array['General']['Timestamp'];
 
# Write each elements section and value to it's own variable name and value
if (is_array($ini_array['General'])) {
  foreach ($ini_array['General'] as $key => $val) {
$$key = $val;
  }

  # Create the SQL statement, query to see if a record exists for that hostname, and count the number of results
  $sql = "SELECT * FROM computers WHERE hostname='$Hostname'";
  $result = mysql_query($sql) or die("SQL query failed, please contact your administrator. Reported Error:  ".logErrors('general',mysql_error(),$ComputerCount)."\n");
  $count = mysql_num_rows($result);
  # If no record exists, write that hostname's information to the database
  if ($count == 0) {
$result2 = mysql_query("INSERT INTO computers (hostname,ip,mac,os,os_ver,scriptruntime) VALUES('$Hostname','$IP','$MAC','$OS','$Ver','$ScriptRunTime')") or die("SQL query failed on $hostname. Reported Error:  ".logErrors('general',mysql_error(),$ComputerCount)."\n");
  # If a record already exists, check to see if any of the values have changed; if they have, dynamically create the SQL statement to only update the changes and do it
  } elseif ($count == 1) {
while ($row = mysql_fetch_assoc($result)) {
  if ($Hostname != $row['hostname']) $temp['hostname'] = $Hostname;
  if ($IP != $row['ip']) $temp['ip'] = $IP;
  if ($MAC != $row['mac']) $temp['mac'] = $MAC;
  if ($OS != $row['os']) $temp['os'] = $OS;
  if ($Ver != $row['os_ver']) $temp['os_ver'] = $Ver;
  if ($ScriptRunTime != $row['scriptruntime']) $temp['scriptruntime'] = $ScriptRunTime;
  if ($Timestamp != $row['Timestamp']) $temp['Timestamp'] = $Timestamp;
  $sql2 = "UPDATE computers SET ";
  if (is_array($temp)) {
foreach ($temp as $key2 => $val2) {
  if ($val2 == end($temp)) {
$sql2 .= "$key2='$val2'";
  } else {
$sql2 .= "$key2='$val2',";
  }
}
  $sql2 .= " WHERE hostname='$Hostname'";
  $result2 = mysql_query($sql2) or die("Updating ".$hostname."'s records failed. Reported Error:  ".logErrors('general',mysql_error(),$ComputerCount)."\n");
  }
}
  # If there is either more than 1 record in the DB for that hostname or a different error occurred, halt script execution
  } elseif ($count > 1) {
fwrite(STDOUT, "Multiple computer accounts with the same name exist in the DB.");
  } else {
fwrite(STDOUT, "An unforseen error has occurred.  Please contact your site administrator.");
exit;
  }
} else {
fwrite(STDOUT, "The array for 'General' information could not be created on $INIPath$INIFile.\n");
unlink($INIPath.$INIFile);
continue;
}

# Grab the id field of the computer we're trying to add information to
$CompIDResult = mysql_query("SELECT id FROM computers WHERE hostname='$HostName'") or die("Computer ID selection failed, please contact your site administrator. Reported Error:  ".logErrors('compidl',mysql_error(),$ComputerCount)."\n");
$CompIDCount = mysql_num_rows($CompIDResult);
$CompIDRow = mysql_fetch_row($CompIDResult);
$CompID = $CompIDRow[0];


if (!isset($CompID)) {
fwrite(STDOUT, "Computer ID query failed.  This is most likely the result of needing to run the Exec General INI again.");
exit;
}

if (is_array($ini_array['Processes'])) {
  # Iterate all processes that are running when the user logs on, verify that they exist in the DB, or write them to the database
  foreach ($ini_array['Processes'] as $Proc) {
list($ProcName,$ProcPath,$ProcVersion,$ProcPublisher) = explode("*",$Proc);
$ProcResult = mysql_query("SELECT * FROM processes WHERE name='$ProcName'") or die("Process verification query failed, please contact your site administrator. Reported Error:  ".logErrors('processes',mysql_error(),$ComputerCount)."\n");
$ProcCount = mysql_num_rows($ProcResult);
if ($ProcCount == 0) {
  $ProcResult2 = mysql_query("INSERT INTO processes (name) VALUES('$ProcName')") or die("Process SQL INSERT failed for $ProcName, please contact your site administrator Reported Error:  ".logErrors('processes',mysql_error(),$ComputerCount)."\n");
  $ProcID = mysql_insert_id();
  $ProcResult3 = mysql_query("SELECT * FROM process_info WHERE path='$ProcPath'") or die("Process information query failed, please contact your site administrator. Reported Error:  ".logErrors('processes',mysql_error(),$ComputerCount)."\n");
  $ProcCount2 = mysql_num_rows($ProcResult3);
  if ($ProcCount2 == 0) {
$ProcResult4 = mysql_query("INSERT INTO process_info (path) VALUES('$ProcPath')") or die("Process information insert failed, please contact your site administrator.\n".logErrors('processes',mysql_error(),$ComputerCount));
$ProcInfoID = mysql_insert_id();
$ProcResult5 = mysql_query("INSERT INTO computer_process_ids (computer_id,process_id,process_info_id,timestamp) VALUES('$CompID','$ProcID','$ProcInfoID','$Timestamp')") or die("Process ID insert failed(1), please contact your site administrator.\n".logErrors('processes',mysql_error(),$ComputerCount));
  } elseif ($ProcCount2 == 1) {
$ProcInfoRow = mysql_fetch_row($ProcResult3);
$ProcInfoID = $ProcInfoRow[0];
$ProcResult5 = mysql_query("SELECT * FROM computer_process_ids WHERE computer_id='$CompID' AND process_id='$ProcID' AND process_info_id='$ProcInfoID'") or die ("ID selection for processes failed, please contact your site administrator.\n".logErrors('processes',mysql_error(),$ComputerCount));
$ProcCount3 = mysql_num_rows($ProcResult5);
if ($ProcCount3 == 0) {
$ProcResult5 = mysql_query("INSERT INTO computer_process_ids (computer_id,process_id,process_info_id,timestamp) VALUES('$CompID','$ProcID','$ProcInfoID','$Timestamp')") or die("Process ID insert failed(2), please contact your site administrator.\n".logErrors('processes',mysql_error(),$ComputerCount));
} else {
$ProcResult6 = msyql_query("UPDATE computer_process_ids SET timestamp='$Timestamp' WHERE computer_id='$CompID' AND process_id='$ProcID' AND process_info_id='$ProcInfoID'") or die ("ID update for processes failed, please contact your site administrator.\n".logErrors('processes',mysql_error(),$ComputerCount));
}
  } else {
fwrite(STDOUT, "An unexpected error occurred while trying to process the processes for $HostName.\n");
  }
} elseif ($ProcCount == 1) {
  #fwrite(STDOUT, "Process $ProcName has already been added to the database.\n";
  $ProcIDRow = mysql_fetch_row($ProcResult);
  $ProcID = $ProcIDRow[0];
  $ProcResult3 = mysql_query("SELECT * FROM process_info WHERE path='$ProcPath'") or die("Process information query failed, please contact your site administrator. Reported Error:  ".logErrors('processes',mysql_error(),$ComputerCount)."\n");
  $ProcCount2 = mysql_num_rows($ProcResult3);
  if ($ProcCount2 == 0) {
$ProcResult4 = mysql_query("INSERT INTO process_info (path) VALUES('$ProcPath')") or die("Process information insert failed, please contact your site administrator.\n".logErrors('processes',mysql_error(),$ComputerCount));
$ProcInfoID = mysql_insert_id();
$ProcResult5 = mysql_query("SELECT * FROM computer_process_ids WHERE computer_id='$CompID' AND process_id='$ProcID' AND process_info_id='$ProcInfoID'") or die ("ID selection for processes failed, please contact your site administrator.\n".logErrors('processes',mysql_error(),$ComputerCount));
$ProcCount3 = mysql_num_rows($ProcResult5);
if ($ProcCount3 == 0) {
$ProcResult5 = mysql_query("INSERT INTO computer_process_ids (computer_id,process_id,process_info_id,timestamp) VALUES('$CompID','$ProcID','$ProcInfoID','$Timestamp')") or die("Process ID insert failed(3), please contact your site administrator.\n".logErrors('processes',mysql_error(),$ComputerCount));
} else {
$ProcResult6 = msyql_query("UPDATE computer_process_ids SET timestamp='$Timestamp' WHERE computer_id='$CompID' AND process_id='$ProcID' AND process_info_id='$ProcInfoID'") or die ("ID update for processes failed, please contact your site administrator.\n".logErrors('processes',mysql_error(),$ComputerCount));
}
  } elseif ($ProcCount2 == 1) {
$ProcInfoRow = mysql_fetch_row($ProcResult3);
$ProcInfoID = $ProcInfoRow[0];
$ProcResult5 = mysql_query("SELECT * FROM computer_process_ids WHERE computer_id='$CompID' AND process_id='$ProcID' AND process_info_id='$ProcInfoID'") or die ("ID selection for processes failed, please contact your site administrator.\n".logErrors('processes',mysql_error(),$ComputerCount));
$ProcCount3 = mysql_num_rows($ProcResult5);
if ($ProcCount3 == 0) {
$ProcResult5 = mysql_query("INSERT INTO computer_process_ids (computer_id,process_id,process_info_id,timestamp) VALUES('$CompID','$ProcID','$ProcInfoID','$Timestamp')") or die("Process ID insert failed(4), please contact your site administrator.\n Timestamp: $Timestamp \n Hostname: $HostName \n".logErrors('processes',mysql_error(),$ComputerCount));
} else {
$ProcResult6 = mysql_query("UPDATE computer_process_ids SET timestamp='$Timestamp' WHERE computer_id='$CompID' AND process_id='$ProcID' AND process_info_id='$ProcInfoID'") or die ("ID update for processes failed, please contact your site administrator.\n$Timestamp\n".logErrors('processes',mysql_error(),$ComputerCount));
}
  } else {
fwrite(STDOUT, "An unexpected error occurred while trying to process the processes for $HostName.\n");
  }
}
  }
} else {
fwrite(STDOUT, "The array for 'Process' information could not be created on $INIFile.\n");
}


if (is_array($ini_array['Programs'])) {
  # Iterate all programs that are running when the user logs on, verify that they exist in the DB, or write them to the database
  foreach ($ini_array['Programs'] as $Prog) {
list($ProgName,$ProgPath,$ProgVersion,$ProgPublisher) = explode("*",$Prog);
$ProgResult = mysql_query("SELECT * FROM programs WHERE name='$ProgName'") or die("Program verification query failed, please contact your site administrator. Reported Error:  ".mysql_error()."\n");
$ProgCount = mysql_num_rows($ProgResult);
if ($ProgCount == 0) {
  $ProgResult2 = mysql_query("INSERT INTO programs (name) VALUES('$ProgName')") or die("Program SQL INSERT failed for $ProgName, please contact your site administrator Reported Error:  ".mysql_error()."\n");
  $ProgID = mysql_insert_id();
  $ProgResult3 = mysql_query("SELECT * FROM program_info WHERE path='$ProgPath' AND version = '$ProgVersion' AND publisher='$ProgPublisher'") or die("Program information query failed, please contact your site administrator. Reported Error:  ".mysql_error()."\n");
  $ProgCount2 = mysql_num_rows($ProgResult3);
  if ($ProgCount2 == 0) {
$ProgResult4 = mysql_query("INSERT INTO program_info (path,version,publisher) VALUES('$ProgPath','$ProgVersion','$ProgPublisher')") or die("Program information insert failed, please contact your site administrator.\n".mysql_error());
$ProgInfoID = mysql_insert_id();
$ProgResult5 = mysql_query("INSERT INTO computer_program_ids (computer_id,program_id,program_info_id,timestamp) VALUES('$CompID','$ProgID','$ProgInfoID','$Timestamp')") or die("Program ID insert failed(1), please contact your site administrator.\n".mysql_error());
  } elseif ($ProgCount2 == 1) {
$ProgInfoRow = mysql_fetch_row($ProgResult3);
$ProgInfoID = $ProgInfoRow[0];
$ProgResult5 = mysql_query("SELECT * FROM computer_program_ids WHERE computer_id='$CompID' AND program_id='$ProgID' AND program_info_id='$ProgInfoID'") or die ("ID selection for programes failed, please contact your site administrator.\n".mysql_error());
$ProgCount3 = mysql_num_rows($ProgResult5);
if ($ProgCount3 == 0) {
$ProgResult5 = mysql_query("INSERT INTO computer_program_ids (computer_id,program_id,program_info_id,timestamp) VALUES('$CompID','$ProgID','$ProgInfoID','$Timestamp')") or die("Progess ID insert failed(2), please contact your site administrator.\n".mysql_error());
} else {
$ProgResult6 = msyql_query("UPDATE computer_program_ids SET timestamp='".strtotime("now")."' WHERE computer_id='$CompID' AND program_id='$ProgID' AND program_info_id='$ProgInfoID'") or die ("ID update for programes failed, please contact your site administrator.\n$Timestamp\n".mysql_error());
}
  } else {
fwrite(STDOUT, "An unexpected error occurred while trying to process the programs for $HostName.\n");
  }
} elseif ($ProgCount == 1) {
  #fwrite(STDOUT, "Program $ProgName has already been added to the database.\n";
  $ProgIDRow = mysql_fetch_row($ProgResult);
  $ProgID = $ProgIDRow[0];
  $ProgResult3 = mysql_query("SELECT * FROM program_info WHERE path='$ProgPath' AND version = '$ProgVersion' AND publisher='$ProgPublisher'") or die("Program information query failed, please contact your site administrator. Reported Error:  ".mysql_error()."\n");
  $ProgCount2 = mysql_num_rows($ProgResult3);
  if ($ProgCount2 == 0) {
$ProgResult4 = mysql_query("INSERT INTO program_info (path,version,publisher) VALUES('$ProgPath','$ProgVersion','$ProgPublisher')") or die("Program information insert failed, please contact your site administrator.\n".mysql_error());
$ProgInfoID = mysql_insert_id();
$ProgResult5 = mysql_query("SELECT * FROM computer_program_ids WHERE computer_id='$CompID' AND program_id='$ProgID' AND program_info_id='$ProgInfoID'") or die ("ID selection for programes failed, please contact your site administrator.\n".mysql_error());
$ProgCount3 = mysql_num_rows($ProgResult5);
if ($ProgCount3 == 0) {
$ProgResult5 = mysql_query("INSERT INTO computer_program_ids (computer_id,program_id,program_info_id,timestamp) VALUES('$CompID','$ProgID','$ProgInfoID','$Timestamp')") or die("Progess ID insert failed(3), please contact your site administrator.\n".mysql_error());
} else {
$ProgResult6 = msyql_query("UPDATE computer_program_ids SET timestamp='".strtotime("now")."' WHERE computer_id='$CompID' AND program_id='$ProgID' AND program_info_id='$ProgInfoID'") or die ("ID update for programes failed, please contact your site administrator.\n$Timestamp\n".mysql_error());
}
  } elseif ($ProgCount2 == 1) {
$ProgInfoRow = mysql_fetch_row($ProgResult3);
$ProgInfoID = $ProgInfoRow[0];
$ProgResult5 = mysql_query("SELECT * FROM computer_program_ids WHERE computer_id='$CompID' AND program_id='$ProgID' AND program_info_id='$ProgInfoID'") or die ("ID selection for programes failed, please contact your site administrator.\n".mysql_error());
$ProgCount3 = mysql_num_rows($ProgResult5);
if ($ProgCount3 == 0) {
$ProgResult5 = mysql_query("INSERT INTO computer_program_ids (computer_id,program_id,program_info_id,timestamp) VALUES('$CompID','$ProgID','$ProgInfoID','$Timestamp')") or die("Progess ID insert failed(4), please contact your site administrator.\n".mysql_error());
} else {
$ProgResult6 = mysql_query("UPDATE computer_program_ids SET timestamp='".strtotime("now")."' WHERE computer_id='$CompID' AND program_id='$ProgID' AND program_info_id='$ProgInfoID'") or die ("ID update for programes failed, please contact your site administrator.\n$Timestamp\n".mysql_error());
}
  } else {
fwrite(STDOUT, "An unexpected error occurred while trying to process the programs for $HostName.\n");
  }
}
  }
} else {
fwrite(STDOUT, "The array for 'Program' information could not be created on $INIFile.\n");
} [/code]

Share this post


Link to post
Share on other sites
It's an unusual thing, you might be able to find a command line way to change a process priority and exec it.

Share this post


Link to post
Share on other sites
How many writes are you doing?  Because they will always taking longer than selects and may be the cause of this bottleneck.

Share this post


Link to post
Share on other sites
Have you got a php Optimizer installed that might fasten things up.

Share this post


Link to post
Share on other sites
PHP's only work in this script seems to be to read a directory and parse ini files. Most of it seems to be queries for MYSQL to handle.

Although there are some ways to minimize the number of queries (In one case a REPLACE could possibly be better), I'd first look at optimizing the tables if they aren't already.

Post the create statement for your tables.
[code]
SHOW CREATE TABLE tablename
[/code]
Btw, how many rows are in your largest table and about how many ini files are usually processed?

Also post the current script execution time for comparison later on.

Share this post


Link to post
Share on other sites
You should think about indexing some fields fields which could speed up things a bit.
Also, try and reduce queries if they're unneccesary or if they can be combined etc.

Share this post


Link to post
Share on other sites
wow... there were quite a few posts so i apologize for not getting back on this one. Shoz is right, almost ALL of the processing happens by MySQL.  The problem is the length of time each file takes to process... so here's the skinny on my project:

I wrote a KiX script that gathers a whole crap-load of information whenever a user logs into our network.  The KiX script appends that information gathered to an INI file in a directory on a web server.  Then a PHP script running via the Windows Task Scheduler every 5 mins, parses this INI directory and compares the contents of each computer_name.INI file and compares it to the database and if there's any new information, it appends that information and updates timestamps.  Some KiX gathered information from a particular computer is detailed below:  [code][General]
MAC=**********
OS=Windows XP Professional
Ver=Service Pack 2
Hostname=******22
IP=*.*.*.125
Timestamp=1153849518
ScriptRunTime=36
[LLU]
1153849518=john.doe
[Processes]
Process1=acachsrv.exe*1616*Path Unknown
Process2=acautoreg.exe*1636*Path Unknown
Process3=acautoup.exe*1684*Path Unknown
Process4=accoca.exe*1748*Path Unknown
Process5=acevtsrv.exe*1712*C:-BSlash-Program Files-BSlash-ActivCard-BSlash-ActivCard Gold-BSlash-acevtsrv.exe
Process6=agquickp.exe*500*C:-BSlash-Program Files-BSlash-ActivCard-BSlash-ActivCard Gold-BSlash-agquickp.exe
Process7=alg.exe*840*Path Unknown
Process8=ccApp.exe*1628*C:-BSlash-Program Files-BSlash-Common Files-BSlash-Symantec Shared-BSlash-ccApp.exe
Process9=ccEvtMgr.exe*1152*Path Unknown
Process10=CcmExec.exe*372*Path Unknown
Process11=ccSetMgr.exe*1188*Path Unknown
Process12=cmd.exe*4020*C:-BSlash-WINNT-BSlash-system32-BSlash-cmd.exe
Process13=cscript.exe*4088*C:-BSlash-WINNT-BSlash-system32-BSlash-cscript.exe
Process14=csrss.exe*528*Path Unknown
Process15=DefWatch.exe*1772*Path Unknown
Process16=explorer.exe*4052*C:-BSlash-WINNT-BSlash-Explorer.EXE
Process17=GlobalAddressUpater.exe*2572*C:-BSlash-DOCUME-Tilde-1-BSlash-JOSEPH-Tilde-1.MIR-BSlash-LOCALS-Tilde-1-BSlash-Temp-BSlash-GlobalAddressUpater.exe
Process18=GWInkMonitor.exe*2328*C:-BSlash-Program Files-BSlash-Gateway Utilities-BSlash-GWInkMonitor.exe
Process19=jusched.exe*2920*C:-BSlash-Program Files-BSlash-Java-BSlash-jre1.5.0_06-BSlash-bin-BSlash-jusched.exe
Process20=KIX32.EXE*496*Path Unknown
Process21=lsass.exe*608*Path Unknown
Process22=masqform.exe*3064*C:-BSlash-Program Files-BSlash-PureEdge-BSlash-Viewer 6.0-BSlash-masqform.exe
Process23=mdm.exe*1860*Path Unknown
Process24=msiexec.exe*3416*Path Unknown
Process25=nvsvc32.exe*1900*Path Unknown
Process26=qttask.exe*2908*C:-BSlash-Program Files-BSlash-QuickTime-BSlash-qttask.exe
Process27=reader_sl.exe*1096*C:-BSlash-Program Files-BSlash-Adobe-BSlash-Acrobat 7.0-BSlash-Reader-BSlash-reader_sl.exe
Process28=Rtvscan.exe*2032*Path Unknown
Process29=rundll32.exe*2956*C:-BSlash-WINNT-BSlash-system32-BSlash-RUNDLL32.EXE
Process30=SavRoam.exe*1936*Path Unknown
Process31=scardsvr.exe*1456*Path Unknown
Process32=services.exe*596*Path Unknown
Process33=smss.exe*480*Path Unknown
Process34=SPBBCSvc.exe*1304*Path Unknown
Process35=spoolsv.exe*1364*Path Unknown
Process36=svchost.exe*1004*Path Unknown
Process37=svchost.exe*1036*Path Unknown
Process38=svchost.exe*2016*Path Unknown
Process39=svchost.exe*788*Path Unknown
Process40=svchost.exe*852*Path Unknown
Process41=svchost.exe*924*Path Unknown
Process42=System Idle Process*0*Path Unknown
Process43=System*4*Path Unknown
Process44=unsecapp.exe*2112*C:-BSlash-WINNT-BSlash-System32-BSlash-wbem-BSlash-unsecapp.exe
Process45=userinit.exe*1084*C:-BSlash-WINNT-BSlash-system32-BSlash-userinit.exe
Process46=VPTray.exe*3092*C:-BSlash-PROGRA-Tilde-1-BSlash-SYMANT-Tilde-2-BSlash-VPTray.exe
Process47=winlogon.exe*552*Path Unknown
Process48=wmiprvse.exe*1644*Path Unknown
Process49=wmiprvse.exe*2072*Path Unknown
Process50=wmiprvse.exe*2524*Path Unknown
Process51=wmiprvse.exe*3508*Path Unknown
Process52=wscript.exe*2208*C:-BSlash-WINNT-BSlash-system32-BSlash-Wscript.exe
Process53=wscript.exe*3612*C:-BSlash-WINNT-BSlash-system32-BSlash-Wscript.exe
Process54=Wuser32.exe*216*Path Unknown
[Services]
Service1=ACachSrv*ActivCard Authentication Service*C:-BSlash-Program Files-BSlash-Common Files-BSlash-ActivCard-BSlash-acachsrv.exe*Auto*Running*LocalSystem
Service2=acautoreg*ActivCard Gold Autoregister*C:-BSlash-Program Files-BSlash-Common Files-BSlash-ActivCard-BSlash-acautoreg.exe*Auto*Running*LocalSystem
Service3=acautoupdate*ActivCard Auto-Update Service*C:-BSlash-Program Files-BSlash-Common Files-BSlash-ActivCard-BSlash-acautoup.exe*Auto*Running*LocalSystem
Service4=Accoca*ActivCard Gold service*C:-BSlash-Program Files-BSlash-Common Files-BSlash-ActivCard-BSlash-accoca.exe*Auto*Running*NT AUTHORITY-BSlash-LocalService
Service5=Alerter*Alerter*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k LocalService*Disabled*Stopped*NT AUTHORITY-BSlash-LocalService
Service6=ALG*Application Layer Gateway Service*C:-BSlash-WINNT-BSlash-System32-BSlash-alg.exe*Manual*Running*NT AUTHORITY-BSlash-LocalService
Service7=AppMgmt*Application Management*C:-BSlash-WINNT-BSlash-system32-BSlash-svchost.exe -k netsvcs*Manual*Stopped*LocalSystem
Service8=aspnet_state*ASP.NET State Service*C:-BSlash-WINNT-BSlash-Microsoft.NET-BSlash-Framework-BSlash-v1.1.4322-BSlash-aspnet_state.exe*Manual*Stopped*NT AUTHORITY-BSlash-NetworkService
Service9=AudioSrv*Windows Audio*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service10=BITS*Background Intelligent Transfer Service*C:-BSlash-WINNT-BSlash-system32-BSlash-svchost.exe -k netsvcs*Manual*Stopped*LocalSystem
Service11=Browser*Computer Browser*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service12=ccEvtMgr*Symantec Event Manager*-SQuote-C:-BSlash-Program Files-BSlash-Common Files-BSlash-Symantec Shared-BSlash-ccEvtMgr.exe-SQuote-*Auto*Running*LocalSystem
Service13=CcmExec*SMS Agent Host*C:-BSlash-WINNT-BSlash-System32-BSlash-CCM-BSlash-CcmExec.exe*Auto*Running*LocalSystem
Service14=ccSetMgr*Symantec Settings Manager*-SQuote-C:-BSlash-Program Files-BSlash-Common Files-BSlash-Symantec Shared-BSlash-ccSetMgr.exe-SQuote-*Auto*Running*LocalSystem
Service15=CiSvc*Indexing Service*C:-BSlash-WINNT-BSlash-system32-BSlash-cisvc.exe*Manual*Stopped*LocalSystem
Service16=ClipSrv*ClipBook*C:-BSlash-WINNT-BSlash-system32-BSlash-clipsrv.exe*Disabled*Stopped*LocalSystem
Service17=COMSysApp*COM+ System Application*C:-BSlash-WINNT-BSlash-System32-BSlash-dllhost.exe /Processid:-LCBrace-02D4B3F1-FD88-11D1-960D-00805FC79235-RCBrace-*Manual*Stopped*LocalSystem
Service18=CryptSvc*Cryptographic Services*C:-BSlash-WINNT-BSlash-system32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service19=DcomLaunch*DCOM Server Process Launcher*C:-BSlash-WINNT-BSlash-system32-BSlash-svchost -k DcomLaunch*Auto*Running*LocalSystem
Service20=DefWatch*Symantec AntiVirus Definition Watcher*-SQuote-C:-BSlash-Program Files-BSlash-Symantec AntiVirus-BSlash-DefWatch.exe-SQuote-*Auto*Running*LocalSystem
Service21=Dhcp*DHCP Client*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service22=dmadmin*Logical Disk Manager Administrative Service*C:-BSlash-WINNT-BSlash-System32-BSlash-dmadmin.exe /com*Manual*Stopped*LocalSystem
Service23=dmserver*Logical Disk Manager*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service24=Dnscache*DNS Client*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k NetworkService*Auto*Running*NT AUTHORITY-BSlash-NetworkService
Service25=ERSvc*Error Reporting Service*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service26=Eventlog*Event Log*C:-BSlash-WINNT-BSlash-system32-BSlash-services.exe*Auto*Running*LocalSystem
Service27=EventSystem*COM+ Event System*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Manual*Running*LocalSystem
Service28=FastUserSwitchingCompatibility*Fast User Switching Compatibility*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Manual*Stopped*LocalSystem
Service29=hClient*Hercules Client*C:-BSlash-program files-BSlash-Citadel-BSlash-Hercules-BSlash-Client-BSlash-HercClient.exe*Auto*Stopped*LocalSystem
Service30=helpsvc*Help and Support*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service31=HidServ*Human Interface Device Access*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Disabled*Stopped*LocalSystem
Service32=HTTPFilter*HTTP SSL*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k HTTPFilter*Manual*Stopped*LocalSystem
Service33=ImapiService*IMAPI CD-Burning COM Service*C:-BSlash-WINNT-BSlash-System32-BSlash-imapi.exe*Manual*Stopped*LocalSystem
Service34=lanmanserver*Server*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service35=lanmanworkstation*Workstation*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service36=LiveUpdate*LiveUpdate*-SQuote-C:-BSlash-PROGRA-Tilde-1-BSlash-Symantec-BSlash-LIVEUP-Tilde-1-BSlash-LUCOMS-Tilde-1.EXE-SQuote-*Manual*Stopped*LocalSystem
Service37=LmHosts*TCP/IP NetBIOS Helper*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k LocalService*Auto*Running*NT AUTHORITY-BSlash-LocalService
Service38=MDM*Machine Debug Manager*-SQuote-C:-BSlash-Program Files-BSlash-Common Files-BSlash-Microsoft Shared-BSlash-VS7Debug-BSlash-mdm.exe-SQuote-*Auto*Running*LocalSystem
Service39=Messenger*Messenger*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service40=mnmsrvc*NetMeeting Remote Desktop Sharing*C:-BSlash-WINNT-BSlash-System32-BSlash-mnmsrvc.exe*Manual*Stopped*LocalSystem
Service41=MSDTC*Distributed Transaction Coordinator*C:-BSlash-WINNT-BSlash-System32-BSlash-msdtc.exe*Manual*Stopped*NT Authority-BSlash-NetworkService
Service42=MSIServer*Windows Installer*C:-BSlash-WINNT-BSlash-system32-BSlash-msiexec.exe /V*Manual*Running*LocalSystem
Service43=NetDDE*Network DDE*C:-BSlash-WINNT-BSlash-system32-BSlash-netdde.exe*Disabled*Stopped*LocalSystem
Service44=NetDDEdsdm*Network DDE DSDM*C:-BSlash-WINNT-BSlash-system32-BSlash-netdde.exe*Disabled*Stopped*LocalSystem
Service45=Netlogon*Net Logon*C:-BSlash-WINNT-BSlash-System32-BSlash-lsass.exe*Auto*Running*LocalSystem
Service46=Netman*Network Connections*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Manual*Running*LocalSystem
Service47=NetSvc*Intel NCS NetService*C:-BSlash-Program Files-BSlash-Intel-BSlash-PROSetWired-BSlash-NCS-BSlash-Sync-BSlash-NetSvc.exe*Manual*Stopped*LocalSystem
Service48=Nla*Network Location Awareness -LParen-NLA-RParen-*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Manual*Running*LocalSystem
Service49=NtLmSsp*NT LM Security Support Provider*C:-BSlash-WINNT-BSlash-System32-BSlash-lsass.exe*Manual*Stopped*LocalSystem
Service50=NtmsSvc*Removable Storage*C:-BSlash-WINNT-BSlash-system32-BSlash-svchost.exe -k netsvcs*Manual*Stopped*LocalSystem
Service51=NVSvc*NVIDIA Display Driver Service*C:-BSlash-WINNT-BSlash-System32-BSlash-nvsvc32.exe*Auto*Running*LocalSystem
Service52=OracleClientCache80*OracleClientCache80*C:-BSlash-ACES-BSlash-BIN-BSlash-ONRSD80.EXE*Manual*Stopped*LocalSystem
Service53=ose*Office Source Engine*-SQuote-C:-BSlash-Program Files-BSlash-Common Files-BSlash-Microsoft Shared-BSlash-Source Engine-BSlash-OSE.EXE-SQuote-*Manual*Stopped*LocalSystem
Service54=PlugPlay*Plug and Play*C:-BSlash-WINNT-BSlash-system32-BSlash-services.exe*Auto*Running*LocalSystem
Service55=PolicyAgent*IPSEC Services*C:-BSlash-WINNT-BSlash-System32-BSlash-lsass.exe*Auto*Running*LocalSystem
Service56=ProtectedStorage*Protected Storage*C:-BSlash-WINNT-BSlash-system32-BSlash-lsass.exe*Auto*Running*LocalSystem
Service57=RasAuto*Remote Access Auto Connection Manager*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Manual*Stopped*LocalSystem
Service58=RasMan*Remote Access Connection Manager*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Manual*Stopped*LocalSystem
Service59=RDSessMgr*Remote Desktop Help Session Manager*C:-BSlash-WINNT-BSlash-system32-BSlash-sessmgr.exe*Manual*Stopped*LocalSystem
Service60=RemoteAccess*Routing and Remote Access*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Disabled*Stopped*LocalSystem
Service61=RemoteRegistry*Remote Registry*C:-BSlash-WINNT-BSlash-system32-BSlash-svchost.exe -k LocalService*Auto*Running*NT AUTHORITY-BSlash-LocalService
Service62=RpcLocator*Remote Procedure Call -LParen-RPC-RParen- Locator*C:-BSlash-WINNT-BSlash-System32-BSlash-locator.exe*Manual*Stopped*NT AUTHORITY-BSlash-NetworkService
Service63=RpcSs*Remote Procedure Call -LParen-RPC-RParen-*C:-BSlash-WINNT-BSlash-system32-BSlash-svchost -k rpcss*Auto*Running*NT Authority-BSlash-NetworkService
Service64=RSVP*QoS RSVP*C:-BSlash-WINNT-BSlash-System32-BSlash-rsvp.exe*Manual*Stopped*LocalSystem
Service65=SamSs*Security Accounts Manager*C:-BSlash-WINNT-BSlash-system32-BSlash-lsass.exe*Auto*Running*LocalSystem
Service66=SavRoam*SAVRoam*-SQuote-C:-BSlash-Program Files-BSlash-Symantec AntiVirus-BSlash-SavRoam.exe-SQuote-*Auto*Running*LocalSystem
Service67=SCardSvr*Smart Card*C:-BSlash-WINNT-BSlash-System32-BSlash-SCardSvr.exe*Auto*Running*NT AUTHORITY-BSlash-LocalService
Service68=Schedule*Task Scheduler*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service69=seclogon*Secondary Logon*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service70=SENS*System Event Notification*C:-BSlash-WINNT-BSlash-system32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service71=SharedAccess*Windows Firewall/Internet Connection Sharing -LParen-ICS-RParen-*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service72=ShellHWDetection*Shell Hardware Detection*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service73=SPBBCSvc*Symantec SPBBCSvc*-SQuote-C:-BSlash-Program Files-BSlash-Common Files-BSlash-Symantec Shared-BSlash-SPBBC-BSlash-SPBBCSvc.exe-SQuote-*Auto*Running*LocalSystem
Service74=Spooler*Print Spooler*C:-BSlash-WINNT-BSlash-system32-BSlash-spoolsv.exe*Auto*Running*LocalSystem
Service75=srservice*System Restore Service*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service76=SSDPSRV*SSDP Discovery Service*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k LocalService*Manual*Running*NT AUTHORITY-BSlash-LocalService
Service77=stisvc*Windows Image Acquisition -LParen-WIA-RParen-*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k imgsvc*Auto*Running*LocalSystem
Service78=SwPrv*MS Software Shadow Copy Provider*C:-BSlash-WINNT-BSlash-System32-BSlash-dllhost.exe /Processid:-LCBrace-9091FC78-379E-45C5-93F0-2AD6CC404A31-RCBrace-*Manual*Stopped*LocalSystem
Service79=Symantec AntiVirus*Symantec AntiVirus*-SQuote-C:-BSlash-Program Files-BSlash-Symantec AntiVirus-BSlash-Rtvscan.exe-SQuote-*Auto*Running*LocalSystem
Service80=SysmonLog*Performance Logs and Alerts*C:-BSlash-WINNT-BSlash-system32-BSlash-smlogsvc.exe*Manual*Stopped*NT Authority-BSlash-NetworkService
Service81=TapiSrv*Telephony*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Manual*Stopped*LocalSystem
Service82=TermService*Terminal Services*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost -k DComLaunch*Auto*Running*LocalSystem
Service83=Themes*Themes*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service84=TlntSvr*Telnet*C:-BSlash-WINNT-BSlash-System32-BSlash-tlntsvr.exe*Disabled*Stopped*LocalSystem
Service85=TrkWks*Distributed Link Tracking Client*C:-BSlash-WINNT-BSlash-system32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service86=upnphost*Universal Plug and Play Device Host*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k LocalService*Manual*Stopped*NT AUTHORITY-BSlash-LocalService
Service87=UPS*Uninterruptible Power Supply*C:-BSlash-WINNT-BSlash-System32-BSlash-ups.exe*Manual*Stopped*NT AUTHORITY-BSlash-LocalService
Service88=VSS*Volume Shadow Copy*C:-BSlash-WINNT-BSlash-System32-BSlash-vssvc.exe*Manual*Stopped*LocalSystem
Service89=W32Time*Windows Time*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service90=WebClient*WebClient*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k LocalService*Auto*Running*NT AUTHORITY-BSlash-LocalService
Service91=winmgmt*Windows Management Instrumentation*C:-BSlash-WINNT-BSlash-system32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service92=WmdmPmSN*Portable Media Serial Number Service*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Manual*Stopped*LocalSystem
Service93=Wmi*Windows Management Instrumentation Driver Extensions*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service94=WmiApSrv*WMI Performance Adapter*C:-BSlash-WINNT-BSlash-System32-BSlash-wbem-BSlash-wmiapsrv.exe*Manual*Stopped*LocalSystem
Service95=wscsvc*Security Center*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Auto*Stopped*LocalSystem
Service96=wuauserv*Automatic Updates*C:-BSlash-WINNT-BSlash-system32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service97=Wuser32*SMS Remote Control Agent*C:-BSlash-WINNT-BSlash-System32-BSlash-CCM-BSlash-CLICOMP-BSlash-RemCtrl-BSlash-Wuser32.exe*Auto*Running*LocalSystem
Service98=WZCSVC*Wireless Zero Configuration*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Auto*Running*LocalSystem
Service99=xmlprov*Network Provisioning Service*C:-BSlash-WINNT-BSlash-System32-BSlash-svchost.exe -k netsvcs*Manual*Stopped*LocalSystem
[Programs]
Program1=3D Pinball*C:-BSlash-Program Files-BSlash-Windows NT-BSlash-Pinball-BSlash-pinball.exe*5.1.2600.2180*Cinematronics
Program2=767 Aircraft Familiarization*767 Aircraft Familiarization*N/A*N/A
Program3=A10 Aircraft Familiarization*A10 Aircraft Familiarization*N/A*N/A
Program4=ActivCard Gold for CAC - PKI - Version 3.0 Feature Pack 1*-LCBrace-F489174B-CF14-4B4D-84BB-C1AD46EDB412-RCBrace-*3.01.1076.1*ActivCard
Program5=Address Book*C:-BSlash-Program Files-BSlash-Outlook Express-BSlash-wab.exe*6.0.2900.2180*Microsoft Corporation
Program6=Adobe Reader 7.0*C:-BSlash-Program Files-BSlash-Adobe-BSlash-Acrobat 7.0-BSlash-Reader-BSlash-AcroRd32.exe*7.0.7.142*Adobe Systems Incorporated
Program7=Ahead Nero BurnRights*Nero BurnRights-EPoint-UninstallKey*N/A*N/A
Program8=Aircraft Familiarization - 737*-LCBrace-CEE76A20-94F7-11D4-84C9-00105AE3A578-RCBrace-*N/A*N/A
Program9=Aircraft Familiarization - 757*-LCBrace-9BD3FD30-AEBB-11D4-84D2-00105AE3A578-RCBrace-*N/A*N/A
Program10=Aircraft Familiarization - 777*-LCBrace-E8426890-4BBC-11D5-8514-00105AE3A578-RCBrace-*N/A*N/A
Program11=Authorware Runtime*c:-BSlash-ic_trng-BSlash-F-16-BSlash-logon.exe*4.0.0.0*Macromedia, Inc.
Program12=Authorware Runtime*C:-BSlash-Program Files-BSlash-ic_trng-BSlash-af_737-BSlash-af737.exe*5.2.0.0*Macromedia, Inc.
Program13=Authorware Runtime*C:-BSlash-Program Files-BSlash-ic_trng-BSlash-af_757-BSlash-AF757.exe*5.2.0.0*Macromedia, Inc.
Program14=Authorware Runtime*C:-BSlash-Program Files-BSlash-ic_trng-BSlash-af_777-BSlash-AF777.exe*5.2.0.0*Macromedia, Inc.
Program15=Authorware Runtime*C:-BSlash-Program Files-BSlash-ic_trng-BSlash-consp2-BSlash-CS2.exe*5.1.0.0*Macromedia, Inc.
Program16=Authorware Runtime*C:-BSlash-Program Files-BSlash-ic_trng-BSlash-consp3-BSlash-cs3logon.exe*5.1.0.0*Macromedia, Inc.
Program17=Authorware Runtime*C:-BSlash-Program Files-BSlash-ic_trng-BSlash-consp4-BSlash-cs4.exe*5.2.0.0*Macromedia, Inc.
Program18=Authorware Runtime*C:-BSlash-Program Files-BSlash-ic_trng-BSlash-fa_fr-BSlash-fafr.exe*6.0.0.0*Macromedia, Inc.
Program19=C-130*C-130*N/A*N/A
Program20=CommVault Systems DataMigrator Outlook Add-In*-LCBrace-49CE7E71-9F17-4B93-82E0-E1F1EF02DCDC-RCBrace-*6.1.2*CommVault Systems
Program21=Config Safe*ConfigSafe*N/A*N/A
Program22=Confined Space Series: Awareness*-LCBrace-D26E9092-C84E-11D3-B964-00403394B10A-RCBrace-*N/A*N/A
Program23=Confined Space Series: Operations*-LCBrace-7DDC47B2-F51D-11D3-8428-00105AE3A578-RCBrace-*N/A*N/A
Program24=Confined Space Series: Support Material*-LCBrace-6F2F9B72-17B3-11D4-846C-00105AE3A578-RCBrace-*N/A*N/A
Program25=Confined Space Series: Technician*-LCBrace-7F04CFAF-0C79-11D4-8450-00105AE3A578-RCBrace-*N/A*N/A
Program26=Cover Designer*C:-BSlash-Program Files-BSlash-Ahead-BSlash-CoverDesigner-BSlash-CoverDes.exe*2.3.0.4*Ahead Software AG
Program27=COVER Train 2.0 Adminstrator*InstallShield_-LCBrace-ED71D4CC-3810-4CD9-9E3C-D87FC2945F3F-RCBrace-*2.0.27*C2 Technologies, Inc.
Program28=COVER Train Patch 2.0.53*InstallShield_-LCBrace-1804DB0C-D502-4759-8865-4072547B1A99-RCBrace-*2.0.53*C2 Technologies, Inc
Program29=DBsign Client Configuration Utility*C:-BSlash-Program Files-BSlash-Gradkell Systems, Inc-BSlash-DBsign Web Signer-BSlash-lib-BSlash-DBsignClientConfig.exe*2.3.6.0*Gradkell Systems, Inc.
Program30=DoMore*-LCBrace-E5B26C1E-4751-4F03-BC18-634F41F31EC6-RCBrace-*1*N/A
Program31=F-117A Aircraft Familiarization*F-117A Aircraft Familiarization*N/A*N/A
Program32=F-15 Familiarization Training*F-15 Familiarization Training*N/A*N/A
Program33=F-16 Familiarization Training II*F-16 Familiarization Training II*N/A*N/A
Program34=Files and Settings Transfer Wizard*C:-BSlash-WINNT-BSlash-system32-BSlash-usmt-BSlash-migwiz.exe*5.1.2600.2180*Microsoft Corporation
Program35=First Aid First Responder*-LCBrace-E9EEC450-E6C2-11D5-8526-00105AE3A578-RCBrace-*N/A*N/A
Program36=Flash Player 5.0 r30*C:-BSlash-Program Files-BSlash-ic_trng-BSlash-CSSM-BSlash-cssm.exe*5.0.30.0*Macromedia, Inc.
Program37=FormFlow 2.22 Filler*FormFlow 2.2 Filler*N/A*N/A
Program38=FormFlow Filler*C:-BSlash-FormFlow-BSlash-DFFILL.EXE*2.1.0.0*JetForm
Program39=Gateway Ink Monitor*C:-BSlash-Program Files-BSlash-Gateway Utilities-BSlash-GWInkMonitor.exe*1.0.0.21*Gateway
Program40=High Definition Audio Driver Package - KB888111*KB888111WXPSP2*20040219.000000*Microsoft Corporation
Program41=HyperTerminal Applet*C:-BSlash-Program Files-BSlash-Windows NT-BSlash-hypertrm.exe*5.1.2600.0*Hilgraeve, Inc.
Program42=ICS Viewer 6.0*-LCBrace-E0000600-0600-0600-0600-000000000600-RCBrace-*N/A*N/A
Program43=ICS Viewer*C:-BSlash-Program Files-BSlash-PureEdge-BSlash-Viewer 6.0-BSlash-masqform.exe*6.0.1.51*PureEdge Solutions Inc.
Program44=Intel-LParen-R-RParen- PRO Network Adapters and Drivers*PROSet*N/A*N/A
Program45=Intel-LParen-R-RParen- PROSet for Wired Connections*-LCBrace-16906D21-0656-4F8B-9A01-C3D24B5401FC-RCBrace-*7.10.0000*Intel
Program46=InterActual Player*InterActual Player*N/A*N/A
Program47=Internet Connection Wizard*C:-BSlash-Program Files-BSlash-Internet Explorer-BSlash-Connection Wizard-BSlash-ICWCONN1.EXE*6.0.2900.2180*Microsoft Corporation
Program48=Internet Connection Wizard*C:-BSlash-Program Files-BSlash-Internet Explorer-BSlash-Connection Wizard-BSlash-ICWCONN2.EXE*6.0.2900.2180*Microsoft Corporation
Program49=Internet Connection Wizard*C:-BSlash-Program Files-BSlash-Internet Explorer-BSlash-Connection Wizard-BSlash-INETWIZ.EXE*6.0.2900.2180*Microsoft Corporation
Program50=Internet Explorer Q903235*Q903235*N/A*Microsoft Corporation
Program51=Internet Explorer*C:-BSlash-Program Files-BSlash-Internet Explorer-BSlash-iexplore.exe*6.0.2900.2180*Microsoft Corporation
Program52=Internet Signup*C:-BSlash-Program Files-BSlash-Internet Explorer-BSlash-Connection Wizard-BSlash-ISIGNUP.EXE*6.0.2600.0*Microsoft Corporation
Program53=J2SE Runtime Environment 5.0 Update 6*-LCBrace-3248F0A8-6813-11D6-A77B-00B0D0150060-RCBrace-*1.5.0.60*Sun Microsystems, Inc.
Program54=Java 2 Runtime Environment, SE v1.4.2_10*-LCBrace-7148F0A8-6813-11D6-A77B-00B0D0142100-RCBrace-*1.4.2_10*Sun Microsystems, Inc.
Program55=Java-LParen-TM-RParen- Web Start Launcher*C:-BSlash-Program Files-BSlash-Java-BSlash-jre1.5.0_06-BSlash-bin-BSlash-javaws.exe*5.0.60.5*Sun Microsystems, Inc.
Program56=knowledgeWorks LMS*-LCBrace-E85FAB4B-AC88-4885-9369-B033F06B4643-RCBrace-*N/A*N/A
Program57=LiveUpdate Wizard*C:-BSlash-PROGRA-Tilde-1-BSlash-Symantec-BSlash-LiveUpdate-BSlash-LUALL.EXE*3.0.0.160*Symantec Corporation
Program58=Macromedia Flash Player 8*-LCBrace-6815FCDD-401D-481E-BA88-31B4754C2B46-RCBrace-*8.0.22.0*Macromedia
Program59=Macromedia Shockwave Player*Macromedia Shockwave Player*10.1.0.11*Macromedia, Inc.
Program60=MFC-Anwendung NeroBurnRightsExe*C:-BSlash-Program Files-BSlash-Ahead-BSlash-NeroBurnRights-BSlash-NeroBurnRights.exe*1.0.0.7*Ahead Software AG
Program61=Microsoft -LParen-R-RParen- Address Book Import Tool*C:-BSlash-Program Files-BSlash-Outlook Express-BSlash-wabmig.exe*6.0.2900.2180*Microsoft Corporation
Program62=Microsoft .NET Framework 1.1 Hotfix -LParen-KB886903-RParen-*M886903*N/A*N/A
Program63=Microsoft Data Access Components KB870669*KB870669*N/A*Microsoft Corporation
Program64=Microsoft DirectX Diagnostic Tool*C:-BSlash-WINNT-BSlash-System32-BSlash-dxdiag.exe*5.3.2600.2180*Microsoft Corporation
Program65=Microsoft Help and Support Center*C:-BSlash-WINNT-BSlash-PCHealth-BSlash-HelpCtr-BSlash-Binaries-BSlash-HelpCtr.exe*5.1.2600.2180*Microsoft Corporation
Program66=Microsoft Office Access*C:-BSlash-PROGRA-Tilde-1-BSlash-MICROS-Tilde-3-BSlash-OFFICE11-BSlash-MSACCESS.EXE*11.0.6566.0*Microsoft Corporation
Program67=Microsoft Office Document Imaging*C:-BSlash-PROGRA-Tilde-1-BSlash-COMMON-Tilde-1-BSlash-MICROS-Tilde-1-BSlash-MODI-BSlash-11.0-BSlash-MSPVIEW.EXE*11.0.1897.0*Microsoft Corporation
Program68=Microsoft Office Excel*C:-BSlash-PROGRA-Tilde-1-BSlash-MICROS-Tilde-3-BSlash-OFFICE11-BSlash-EXCEL.EXE*11.0.8033.0*Microsoft Corporation
Program69=Microsoft Office FrontPage*C:-BSlash-PROGRA-Tilde-1-BSlash-MICROS-Tilde-3-BSlash-OFFICE11-BSlash-FRONTPG.EXE*11.0.6552.0*Microsoft Corporation
Program70=Microsoft Office InfoPath*C:-BSlash-Program Files-BSlash-Microsoft Office-BSlash-OFFICE11-BSlash-INFOPATH.EXE*11.0.6565.0*Microsoft Corporation
Program71=Microsoft Office Outlook*C:-BSlash-PROGRA-Tilde-1-BSlash-MICROS-Tilde-3-BSlash-OFFICE11-BSlash-OUTLOOK.EXE*11.0.8010.0*Microsoft Corporation
Program72=Microsoft Office Picture Manager*C:-BSlash-PROGRA-Tilde-1-BSlash-MICROS-Tilde-3-BSlash-OFFICE11-BSlash-OIS.EXE*11.0.6550.0*Microsoft Corporation
Program73=Microsoft Office PowerPoint*C:-BSlash-PROGRA-Tilde-1-BSlash-MICROS-Tilde-3-BSlash-OFFICE11-BSlash-POWERPNT.EXE*11.0.8024.0*Microsoft Corporation
Program74=Microsoft Office Professional Edition 2003*-LCBrace-90110409-6000-11D3-8CFE-0150048383C9-RCBrace-*11.0.7969.0*Microsoft Corporation
Program75=Microsoft Office Publisher*C:-BSlash-PROGRA-Tilde-1-BSlash-MICROS-Tilde-3-BSlash-OFFICE11-BSlash-MSPUB.EXE*11.0.6565.0*Microsoft Corporation
Program76=Microsoft Office Word*C:-BSlash-PROGRA-Tilde-1-BSlash-MICROS-Tilde-3-BSlash-OFFICE11-BSlash-WINWORD.EXE*11.0.8026.0*Microsoft Corporation
Program77=Microsoft Schedule+ for Windows 95 application file*C:-BSlash-PROGRA-Tilde-1-BSlash-MICROS-Tilde-3-BSlash-OFFICE11-BSlash-1033-BSlash-SCHDPL32.EXE*7.5.1457.3*Microsoft Corporation
Program78=msn*C:-BSlash-Program Files-BSlash-MSN-BSlash-MSNCoreFiles-BSlash-MSN6.exe*7.2.5.2202*Microsoft Corporation
Program79=MyODBC*-LCBrace-29042B1C-0713-4575-B7CA-5C8E7B0899D4-RCBrace-*3.51.11*MySQL
Program80=Nero Burning ROM*C:-BSlash-Program Files-BSlash-Ahead-BSlash-nero-BSlash-nero.exe*6.0.0.20*Ahead Software AG
Program81=Nero OEM*Nero - Burning Rom-EPoint-UninstallKey*N/A*N/A
Program82=Nero StartSmart*C:-BSlash-Program Files-BSlash-Ahead-BSlash-Nero StartSmart-BSlash-NeroStartSmart.exe*1.0.0.11*Ahead Software AG
Program83=NVIDIA Drivers*NVIDIA Drivers*N/A*N/A
Program84=Oracle JInitiator 1.1.8.11*Oracle JInitiator 1.1.8.11*N/A*N/A
Program85=Oracle JInitiator 1.3.1.6*Oracle JInitiator 1.3.1.6*N/A*N/A
Program86=Outlook Express*C:-BSlash-Program Files-BSlash-Outlook Express-BSlash-msimn.exe*6.0.2900.2180*Microsoft Corporation
Program87=Paint*C:-BSlash-WINNT-BSlash-system32-BSlash-mspaint.exe*5.1.2600.2180*Microsoft Corporation
Program88=PC-Doctor for Windows*-LCBrace-1F7CCFA3-D926-4882-B2A5-A0217ED25597-RCBrace-*N/A*N/A
Program89=PictureViewer Application*C:-BSlash-PROGRA-Tilde-1-BSlash-QUICKT-Tilde-1-BSlash-PictureViewer.exe*4.0.0.155*Apple Computer, Inc.
Program90=QuickTime for Windows -LParen-32-bit-RParen-*QuickTime32*N/A*N/A
Program91=QuickTime Player Application*C:-BSlash-PROGRA-Tilde-1-BSlash-QUICKT-Tilde-1-BSlash-QuickTimePlayer.exe*4.0.1.9*Apple Computer, Inc.
Program92=Security Update for Step By Step Interactive Training -LParen-KB898458-RParen-*KB898458*20050502.101010*Microsoft Corporation
Program93=Security Update for Windows Media Player -LParen-KB911564-RParen-*KB911564*N/A*Microsoft Corporation
Program94=Security Update for Windows Media Player 9 -LParen-KB911565-RParen-*KB911565*N/A*Microsoft Corporation
Program95=Security Update for Windows Media Player 9 -LParen-KB917734-RParen-*KB917734_WMP9*N/A*Microsoft Corporation
Program96=Security Update for Windows XP -LParen-KB883939-RParen-*KB883939*1*Microsoft Corporation
Program97=Security Update for Windows XP -LParen-KB890046-RParen-*KB890046*1*Microsoft Corporation
Program98=Security Update for Windows XP -LParen-KB893756-RParen-*KB893756*1*Microsoft Corporation
Program99=Security Update for Windows XP -LParen-KB896358-RParen-*KB896358*1*Microsoft Corporation
Program100=Security Update for Windows XP -LParen-KB896422-RParen-*KB896422*1*Microsoft Corporation
Program101=Security Update for Windows XP -LParen-KB896423-RParen-*KB896423*1*Microsoft Corporation
Program102=Security Update for Windows XP -LParen-KB896424-RParen-*KB896424*1*Microsoft Corporation
Program103=Security Update for Windows XP -LParen-KB896428-RParen-*KB896428*1*Microsoft Corporation
Program104=Security Update for Windows XP -LParen-KB896688-RParen-*KB896688*1*Microsoft Corporation
Program105=Security Update for Windows XP -LParen-KB899587-RParen-*KB899587*1*Microsoft Corporation
Program106=Security Update for Windows XP -LParen-KB899588-RParen-*KB899588*1*Microsoft Corporation
Program107=Security Update for Windows XP -LParen-KB899589-RParen-*KB899589*1*Microsoft Corporation
Program108=Security Update for Windows XP -LParen-KB899591-RParen-*KB899591*1*Microsoft Corporation
Program109=Security Update for Windows XP -LParen-KB900725-RParen-*KB900725*1*Microsoft Corporation
Program110=Security Update for Windows XP -LParen-KB901017-RParen-*KB901017*1*Microsoft Corporation
Program111=Security Update for Windows XP -LParen-KB901214-RParen-*KB901214*1*Microsoft Corporation
Program112=Security Update for Windows XP -LParen-KB902400-RParen-*KB902400*1*Microsoft Corporation
Program113=Security Update for Windows XP -LParen-KB904706-RParen-*KB904706*1*Microsoft Corporation
Program114=Security Update for Windows XP -LParen-KB905414-RParen-*KB905414*1*Microsoft Corporation
Program115=Security Update for Windows XP -LParen-KB905749-RParen-*KB905749*1*Microsoft Corporation
Program116=Security Update for Windows XP -LParen-KB905915-RParen-*KB905915*1*Microsoft Corporation
Program117=Security Update for Windows XP -LParen-KB908519-RParen-*KB908519*1*Microsoft Corporation
Program118=Security Update for Windows XP -LParen-KB908531-RParen-*KB908531*1*Microsoft Corporation
Program119=Security Update for Windows XP -LParen-KB911280-RParen-*KB911280*1*Microsoft Corporation
Program120=Security Update for Windows XP -LParen-KB911562-RParen-*KB911562*1*Microsoft Corporation
Program121=Security Update for Windows XP -LParen-KB911567-RParen-*KB911567*1*Microsoft Corporation
Program122=Security Update for Windows XP -LParen-KB911927-RParen-*KB911927*1*Microsoft Corporation
Program123=Security Update for Windows XP -LParen-KB912812-RParen-*KB912812*1*Microsoft Corporation
Program124=Security Update for Windows XP -LParen-KB912919-RParen-*KB912919*1*Microsoft Corporation
Program125=Security Update for Windows XP -LParen-KB913446-RParen-*KB913446*1*Microsoft Corporation
Program126=Security Update for Windows XP -LParen-KB913580-RParen-*KB913580*1*Microsoft Corporation
Program127=Security Update for Windows XP -LParen-KB914388-RParen-*KB914388*1*Microsoft Corporation
Program128=Security Update for Windows XP -LParen-KB914389-RParen-*KB914389*1*Microsoft Corporation
Program129=Security Update for Windows XP -LParen-KB916281-RParen-*KB916281*1*Microsoft Corporation
Program130=Security Update for Windows XP -LParen-KB917159-RParen-*KB917159*1*Microsoft Corporation
Program131=Security Update for Windows XP -LParen-KB917344-RParen-*KB917344*1*Microsoft Corporation
Program132=Security Update for Windows XP -LParen-KB917953-RParen-*KB917953*1*Microsoft Corporation
Program133=Security Update for Windows XP -LParen-KB918439-RParen-*KB918439*1*Microsoft Corporation
Program134=SMS Advanced Client*-LCBrace-9092C0B8-D5F3-4BF9-808D-20892DEB4F8B-RCBrace-*2.50.3174.1152*Microsoft Corporation
Program135=Symantec AntiVirus*C:-BSlash-Program Files-BSlash-Symantec AntiVirus-BSlash-VPC32.exe*10.1.0.401*Symantec Corporation
Program136=Symantec AntiVirus*C:-BSlash-PROGRA-Tilde-1-BSlash-SYMANT-Tilde-2-BSlash-VPTray.exe*10.1.0.401*Symantec Corporation
Program137=Symantec User Session*C:-BSlash-Program Files-BSlash-Common Files-BSlash-Symantec Shared-BSlash-ccApp.exe*104.0.8.3*Symantec Corporation
Program138=System Configuration Utility*C:-BSlash-WINNT-BSlash-PCHealth-BSlash-HelpCtr-BSlash-Binaries-BSlash-MSConfig.exe*5.1.2600.2180*Microsoft Corporation
Program139=System Information*C:-BSlash-Program Files-BSlash-Common Files-BSlash-Microsoft Shared-BSlash-MSInfo-BSlash-MSInfo32.exe*5.1.2600.0*Microsoft Corporation
Program140=T-38 Familiarization Training*T-38 Familiarization Training*N/A*N/A
Program141=TAPI 3.0 Dialer and IP Multicast Conference Viewer*C:-BSlash-Program Files-BSlash-Windows NT-BSlash-dialer.exe*5.1.2600.2180*Microsoft Corporation
Program142=Update for Windows XP -LParen-KB896727-RParen-*KB896727*1*Microsoft Corporation
Program143=Update for Windows XP -LParen-KB898461-RParen-*KB898461*1*Microsoft Corporation
Program144=Update for Windows XP -LParen-KB910437-RParen-*KB910437*1*Microsoft Corporation
Program145=WebFldrs XP*-LCBrace-350C97B0-3D7C-4EE8-BAA9-00BCB3D54227-RCBrace-*9.50.6513*Microsoft Corporation
Program146=Windows Installer 3.1 -LParen-KB893803-RParen-*KB893803v2*3.1*Microsoft Corporation
Program147=Windows Media Player*C:-BSlash-Program Files-BSlash-Windows Media Player-BSlash-mplayer2.exe*6.4.9.1125*Microsoft Corporation
Program148=Windows Media Player*C:-BSlash-Program Files-BSlash-Windows Media Player-BSlash-wmplayer.exe*9.0.0.3250*Microsoft Corporation
Program149=Windows Messenger*C:-BSlash-Program Files-BSlash-Messenger-BSlash-msmsgs.exe*4.7.0.3001*Microsoft Corporation
Program150=Windows Movie Maker*C:-BSlash-Program Files-BSlash-Movie Maker-BSlash-moviemk.exe*2.1.4026.0*Microsoft Corporation
Program151=Windows Sasser Worm Removal Tool -LParen-KB841720-RParen-*KB841720*N/A*Microsoft Corporation
Program152=Windows XP Hotfix - KB873333*KB873333*20050114.005213*Microsoft Corporation
Program153=Windows XP Hotfix - KB873339*KB873339*20041117.092459*Microsoft Corporation
Program154=Windows XP Hotfix - KB885250*KB885250*20050118.202711*Microsoft Corporation
Program155=Windows XP Hotfix - KB885835*KB885835*20041027.181713*Microsoft Corporation
Program156=Windows XP Hotfix - KB885836*KB885836*20041028.173203*Microsoft Corporation
Program157=Windows XP Hotfix - KB885884*KB885884*20040924.025457*Microsoft Corporation
Program158=Windows XP Hotfix - KB886185*KB886185*20041021.090540*Microsoft Corporation
Program159=Windows XP Hotfix - KB887472*KB887472*20041014.162858*Microsoft Corporation
Program160=Windows XP Hotfix - KB887742*KB887742*20041103.095002*Microsoft Corporation
Program161=Windows XP Hotfix - KB888113*KB888113*20041116.131036*Microsoft Corporation
Program162=Windows XP Hotfix - KB888302*KB888302*20041207.111426*Microsoft Corporation
Program163=Windows XP Hotfix - KB890175*KB890175*20041201.233338*Microsoft Corporation
Program164=Windows XP Hotfix - KB890859*KB890859*1*Microsoft Corporation
Program165=Windows XP Hotfix - KB890923*KB890923*1*Microsoft Corporation
Program166=Windows XP Hotfix - KB891781*KB891781*20050110.165439*Microsoft Corporation
Program167=Windows XP Hotfix - KB893066*KB893066*1*Microsoft Corporation
Program168=Windows XP Hotfix - KB893086*KB893086*1*Microsoft Corporation
Program169=Windows XP Service Pack 2*Windows XP Service Pack*20040803.231319*Microsoft Corporation
Program170=Windows® NetMeeting®*C:-BSlash-Program Files-BSlash-NetMeeting-BSlash-conf.exe*5.1.2600.2180*Microsoft Corporation
Program171=WinDVD MFC Application*C:-BSlash-Program Files-BSlash-DVD-BSlash-DVD Player-BSlash-WinDVD.exe*4.0.11.237*InterVideo Inc.
Program172=WinZip*C:-BSlash-Program Files-BSlash-WinZip-BSlash-winzip32.exe*18.0.6224.0*WinZip Computing, Inc.
Program173=WordPad MFC Application*C:-BSlash-Program Files-BSlash-Windows NT-BSlash-Accessories-BSlash-WORDPAD.EXE*5.1.2600.2180*Microsoft Corporation
Program174=XML Editor*C:-BSlash-Program Files-BSlash-Common Files-BSlash-Microsoft Shared-BSlash-OFFICE11-BSlash-MSOXMLED.EXE*11.0.5510.0*Microsoft Corporation
Program175=Zone Datafile*C:-BSlash-Program Files-BSlash-MSN Gaming Zone-BSlash-Windows-BSlash-bckgzm.exe*1.2.626.1*Microsoft Corporation
Program176=Zone Datafile*C:-BSlash-Program Files-BSlash-MSN Gaming Zone-BSlash-Windows-BSlash-chkrzm.exe*1.2.626.1*Microsoft Corporation
Program177=Zone Datafile*C:-BSlash-Program Files-BSlash-MSN Gaming Zone-BSlash-Windows-BSlash-hrtzzm.exe*1.2.626.1*Microsoft Corporation
Program178=Zone Datafile*C:-BSlash-Program Files-BSlash-MSN Gaming Zone-BSlash-Windows-BSlash-rvsezm.exe*1.2.626.1*Microsoft Corporation
Program179=Zone Datafile*C:-BSlash-Program Files-BSlash-MSN Gaming Zone-BSlash-Windows-BSlash-shvlzm.exe*1.2.626.1*Microsoft Corporation
[/code]

Share this post


Link to post
Share on other sites
[continuation from previous post...]

that's one example file that a computer will write to my logging location on the web server.  Then I have a PHP script that I have set to run every 5 mins that's supposed to open up those INI files, read the contents, compare the contents to the info in the DB, and then either just move on or append new information if there is any.  The thing is, when I was running this on a test scenario, (computers number < 1000) everything worked great.  Now that I started running it live on our network (> 3000 systems) the PHP script can't keep up with the number of users logging in each time.  so the report on the last time the PHP script ran was that it took 17 hrs to parse 1500 systems.  and i've watched the process run and Shoz was right, the PHP.exe just sits there and about every 8 secs or so, it shows 1% CPU usage and MySQL stays around 40% usage the whole time.

The data collection part works flawlessly so far.  It's the INI file reposity to database synchronization where my script is hanging up.  Here is my dump of tables from phpmyadmin:

[code]Database inventory_agent running on localhost
# phpMyAdmin MySQL-Dump
# version 2.2.3
# http://phpwizard.net/phpMyAdmin/
# http://phpmyadmin.sourceforge.net/ (download page)
#
# Host: localhost
# Generation Time: Jul 25, 2006 at 11:44 AM
# Server version: 5.00.22
# PHP Version: 5.1.4
# Database : `inventory_agent`
# --------------------------------------------------------

#
# Table structure for table `computer_process_ids`
#

CREATE TABLE computer_process_ids (
  id int(11) NOT NULL auto_increment,
  computer_id int(11) NOT NULL default '0',
  process_id int(11) NOT NULL default '0',
  process_info_id int(11) default '0',
  `timestamp` int(11) NOT NULL default '0',
  PRIMARY KEY  (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
# --------------------------------------------------------

#
# Table structure for table `computer_program_ids`
#

CREATE TABLE computer_program_ids (
  id int(11) NOT NULL auto_increment,
  computer_id int(11) NOT NULL default '0',
  program_id int(11) NOT NULL default '0',
  program_info_id int(11) NOT NULL default '0',
  `timestamp` int(11) NOT NULL default '0',
  PRIMARY KEY  (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
# --------------------------------------------------------

#
# Table structure for table `computer_service_ids`
#

CREATE TABLE computer_service_ids (
  id int(11) NOT NULL auto_increment,
  computer_id int(11) NOT NULL default '0',
  service_id int(11) NOT NULL default '0',
  service_info_id int(11) NOT NULL default '0',
  `timestamp` int(11) NOT NULL default '0',
  PRIMARY KEY  (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
# --------------------------------------------------------

#
# Table structure for table `computer_username_ids`
#

CREATE TABLE computer_username_ids (
  id int(11) NOT NULL auto_increment,
  computer_id int(11) default '0',
  username_id int(11) default '0',
  `timestamp` int(11) NOT NULL default '0',
  PRIMARY KEY  (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
# --------------------------------------------------------

#
# Table structure for table `computers`
#

CREATE TABLE computers (
  id int(11) NOT NULL auto_increment,
  hostname varchar(20) NOT NULL default '',
  ip varchar(32) NOT NULL default '',
  mac varchar(20) NOT NULL default '',
  os varchar(50) NOT NULL,
  os_ver varchar(30) NOT NULL default '',
  scriptruntime int(11) NOT NULL default '0',
  `timestamp` int(11) NOT NULL default '0',
  PRIMARY KEY  (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
# --------------------------------------------------------

#
# Table structure for table `process_info`
#

CREATE TABLE process_info (
  id int(11) NOT NULL auto_increment,
  path text NOT NULL,
  PRIMARY KEY  (id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
# --------------------------------------------------------

#
# Table structure for table `processes`
#

CREATE TABLE processes (
  id int(11) NOT NULL auto_increment,
  `name` varchar(50) default NULL,
  PRIMARY KEY  (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
# --------------------------------------------------------

#
# Table structure for table `program_info`
#

CREATE TABLE program_info (
  id int(11) NOT NULL auto_increment,
  path text NOT NULL,
  version varchar(75) NOT NULL,
  publisher varchar(150) NOT NULL,
  PRIMARY KEY  (id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
# --------------------------------------------------------

#
# Table structure for table `programs`
#

CREATE TABLE programs (
  id int(11) NOT NULL auto_increment,
  `name` varchar(150) NOT NULL,
  PRIMARY KEY  (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
# --------------------------------------------------------

#
# Table structure for table `script_execution`
#

CREATE TABLE script_execution (
  id int(11) NOT NULL auto_increment,
  `timestamp` int(11) NOT NULL default '0',
  number_of_computers int(11) NOT NULL default '0',
  `status` tinyint(4) NOT NULL default '0',
  scriptruntime int(11) NOT NULL default '0',
  PRIMARY KEY  (id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
# --------------------------------------------------------

#
# Table structure for table `script_execution_errors`
#

CREATE TABLE script_execution_errors (
  id int(11) NOT NULL auto_increment,
  section varchar(50) NOT NULL,
  mysql_error text NOT NULL,
  computers int(11) NOT NULL,
  `timestamp` int(11) NOT NULL,
  PRIMARY KEY  (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
# --------------------------------------------------------

#
# Table structure for table `service_info`
#

CREATE TABLE service_info (
  id int(11) NOT NULL auto_increment,
  path text NOT NULL,
  startup_type varchar(20) NOT NULL,
  `status` varchar(20) NOT NULL,
  authority varchar(75) NOT NULL,
  PRIMARY KEY  (id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
# --------------------------------------------------------

#
# Table structure for table `services`
#

CREATE TABLE services (
  id int(11) NOT NULL auto_increment,
  `name` varchar(100) default NULL,
  display_name varchar(150) default NULL,
  PRIMARY KEY  (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
# --------------------------------------------------------

#
# Table structure for table `usernames`
#

CREATE TABLE usernames (
  id int(11) NOT NULL auto_increment,
  username varchar(30) NOT NULL,
  PRIMARY KEY  (id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

    [/code]


and here is the script for synchronization if anyone can offer me pointers anywhere, i would be soooooo greatly appreciative.  I know this is a whole crap-load of information but i don't know anyone else to ask as I'm the only one who works on projects like these where i work and i've never been in an actual PHP development team before so i don't know any other avenues or colleagues i can turn to.  =/

[code]<?

set_time_limit(0);

require ('functions.php');

function logErrors($section, $mysqlError, $computers) {
global $ScriptStartTime;
$ScriptEndTime = microtime_float();
$ScriptRunTime = $ScriptEndTime - $ScriptStartTime;

$Timestamp = strtotime("now");
$ScriptSQL = "INSERT INTO script_execution (timestamp,number_of_computers,scriptruntime,status) VALUES('".strtotime("now")."','$computers','".round($ScriptRunTime)."','1')";
$ScriptResult = mysql_query($ScriptSQL) or die("Script logging function failed, please contact your administrator.\n $ScriptSQL \n".mysql_error());

$ErrorResult = mysql_query("INSERT INTO script_execution_errors (section,mysql_error,computers,timestamp) VALUES('$section','test','$computers','$Timestamp')") or die ("Error log update failed.\n".mysql_error());
}

$ScriptStartTime = microtime_float();
db_open();

$INIPath = "e:\\inventory_agent\\data\\INIs\\";
$ComputerCount = 1;

if (is_dir($INIPath)) {
  if ($INIDH = opendir($INIPath)) {
    while (($INIFile = readdir($INIDH)) !== false) {
  $INISub = SubStr($INIFile,-4,4);
  $HostName = SubStr($INIFile,0,StrLen($INIFile)-4);
 
  if ($INISub == '.ini') {
if (is_file($INIPath.$INIFile)) {
  $ini_array = parse_ini_file($INIPath.$INIFile, true);
          $Timestamp = $ini_array['General']['Timestamp'];
 
# Write each elements section and value to it's own variable name and value
if (is_array($ini_array['General'])) {
  foreach ($ini_array['General'] as $key => $val) {
$$key = $val;
  }

  # Create the SQL statement, query to see if a record exists for that hostname, and count the number of results
  $sql = "SELECT * FROM computers WHERE hostname='$Hostname'";
  $result = mysql_query($sql) or die("SQL query failed, please contact your administrator. Reported Error:  ".logErrors('general',mysql_error(),$ComputerCount)."\n");
  $count = mysql_num_rows($result);
  # If no record exists, write that hostname's information to the database
  if ($count == 0) {
$result2 = mysql_query("INSERT INTO computers (hostname,ip,mac,os,os_ver,scriptruntime) VALUES('$Hostname','$IP','$MAC','$OS','$Ver','$ScriptRunTime')") or die("SQL query failed on $hostname. Reported Error:  ".logErrors('general',mysql_error(),$ComputerCount)."\n");
  # If a record already exists, check to see if any of the values have changed; if they have, dynamically create the SQL statement to only update the changes and do it
  } elseif ($count == 1) {
while ($row = mysql_fetch_assoc($result)) {
  if ($Hostname != $row['hostname']) $temp['hostname'] = $Hostname;
  if ($IP != $row['ip']) $temp['ip'] = $IP;
  if ($MAC != $row['mac']) $temp['mac'] = $MAC;
  if ($OS != $row['os']) $temp['os'] = $OS;
  if ($Ver != $row['os_ver']) $temp['os_ver'] = $Ver;
  if ($ScriptRunTime != $row['scriptruntime']) $temp['scriptruntime'] = $ScriptRunTime;
  if ($Timestamp != $row['Timestamp']) $temp['Timestamp'] = $Timestamp;
  $sql2 = "UPDATE computers SET ";
  if (is_array($temp)) {
foreach ($temp as $key2 => $val2) {
  if ($val2 == end($temp)) {
$sql2 .= "$key2='$val2'";
  } else {
$sql2 .= "$key2='$val2',";
  }
}
  $sql2 .= " WHERE hostname='$Hostname'";
  $result2 = mysql_query($sql2) or die("Updating ".$hostname."'s records failed. Reported Error:  ".logErrors('general',mysql_error(),$ComputerCount)."\n");
  }
}
  # If there is either more than 1 record in the DB for that hostname or a different error occurred, halt script execution
  } elseif ($count > 1) {
fwrite(STDOUT, "Multiple computer accounts with the same name exist in the DB.");
  } else {
fwrite(STDOUT, "An unforseen error has occurred.  Please contact your site administrator.");
exit;
  }
} else {
fwrite(STDOUT, "The array for 'General' information could not be created on $INIPath$INIFile.\n");
unlink($INIPath.$INIFile);
continue;
}

# Grab the id field of the computer we're trying to add information to
$CompIDResult = mysql_query("SELECT id FROM computers WHERE hostname='$HostName'") or die("Computer ID selection failed, please contact your site administrator. Reported Error:  ".logErrors('compidl',mysql_error(),$ComputerCount)."\n");
$CompIDCount = mysql_num_rows($CompIDResult);
$CompIDRow = mysql_fetch_row($CompIDResult);
$CompID = $CompIDRow[0];


if (!isset($CompID)) {
fwrite(STDOUT, "Computer ID query failed.  This is most likely the result of needing to run the Exec General INI again.");
exit;
}

if (is_array($ini_array['Processes'])) {
  # Iterate all processes that are running when the user logs on, verify that they exist in the DB, or write them to the database
  foreach ($ini_array['Processes'] as $Proc) {
list($ProcName,$ProcPath,$ProcVersion,$ProcPublisher) = explode("*",$Proc);
$ProcResult = mysql_query("SELECT * FROM processes WHERE name='$ProcName'") or die("Process verification query failed, please contact your site administrator. Reported Error:  ".logErrors('processes',mysql_error(),$ComputerCount)."\n");
$ProcCount = mysql_num_rows($ProcResult);
if ($ProcCount == 0) {
  $ProcResult2 = mysql_query("INSERT INTO processes (name) VALUES('$ProcName')") or die("Process SQL INSERT failed for $ProcName, please contact your site administrator Reported Error:  ".logErrors('processes',mysql_error(),$ComputerCount)."\n");
  $ProcID = mysql_insert_id();
  $ProcResult3 = mysql_query("SELECT * FROM process_info WHERE path='$ProcPath'") or die("Process information query failed, please contact your site administrator. Reported Error:  ".logErrors('processes',mysql_error(),$ComputerCount)."\n");
  $ProcCount2 = mysql_num_rows($ProcResult3);
  if ($ProcCount2 == 0) {
$ProcResult4 = mysql_query("INSERT INTO process_info (path) VALUES('$ProcPath')") or die("Process information insert failed, please contact your site administrator.\n".logErrors('processes',mysql_error(),$ComputerCount));
$ProcInfoID = mysql_insert_id();
$ProcResult5 = mysql_query("INSERT INTO computer_process_ids (computer_id,process_id,process_info_id,timestamp) VALUES('$CompID','$ProcID','$ProcInfoID','$Timestamp')") or die("Process ID insert failed(1), please contact your site administrator.\n".logErrors('processes',mysql_error(),$ComputerCount));
  } elseif ($ProcCount2 == 1) {
$ProcInfoRow = mysql_fetch_row($ProcResult3);
$ProcInfoID = $ProcInfoRow[0];
$ProcResult5 = mysql_query("SELECT * FROM computer_process_ids WHERE computer_id='$CompID' AND process_id='$ProcID' AND process_info_id='$ProcInfoID'") or die ("ID selection for processes failed, please contact your site administrator.\n".logErrors('processes',mysql_error(),$ComputerCount));
$ProcCount3 = mysql_num_rows($ProcResult5);
if ($ProcCount3 == 0) {
$ProcResult5 = mysql_query("INSERT INTO computer_process_ids (computer_id,process_id,process_info_id,timestamp) VALUES('$CompID','$ProcID','$ProcInfoID','$Timestamp')") or die("Process ID insert failed(2), please contact your site administrator.\n".logErrors('processes',mysql_error(),$ComputerCount));
} else {
$ProcResult6 = msyql_query("UPDATE computer_process_ids SET timestamp='$Timestamp' WHERE computer_id='$CompID' AND process_id='$ProcID' AND process_info_id='$ProcInfoID'") or die ("ID update for processes failed, please contact your site administrator.\n".logErrors('processes',mysql_error(),$ComputerCount));
}
  } else {
fwrite(STDOUT, "An unexpected error occurred while trying to process the processes for $HostName.\n");
  }
} elseif ($ProcCount == 1) {
  #fwrite(STDOUT, "Process $ProcName has already been added to the database.\n";
  $ProcIDRow = mysql_fetch_row($ProcResult);
  $ProcID = $ProcIDRow[0];
  $ProcResult3 = mysql_query("SELECT * FROM process_info WHERE path='$ProcPath'") or die("Process information query failed, please contact your site administrator. Reported Error:  ".logErrors('processes',mysql_error(),$ComputerCount)."\n");
  $ProcCount2 = mysql_num_rows($ProcResult3);
  if ($ProcCount2 == 0) {
$ProcResult4 = mysql_query("INSERT INTO process_info (path) VALUES('$ProcPath')") or die("Process information insert failed, please contact your site administrator.\n".logErrors('processes',mysql_error(),$ComputerCount));
$ProcInfoID = mysql_insert_id();
$ProcResult5 = mysql_query("SELECT * FROM computer_process_ids WHERE computer_id='$CompID' AND process_id='$ProcID' AND process_info_id='$ProcInfoID'") or die ("ID selection for processes failed, please contact your site administrator.\n".logErrors('processes',mysql_error(),$ComputerCount));
$ProcCount3 = mysql_num_rows($ProcResult5);
if ($ProcCount3 == 0) {
$ProcResult5 = mysql_query("INSERT INTO computer_process_ids (computer_id,process_id,process_info_id,timestamp) VALUES('$CompID','$ProcID','$ProcInfoID','$Timestamp')") or die("Process ID insert failed(3), please contact your site administrator.\n".logErrors('processes',mysql_error(),$ComputerCount));
} else {
$ProcResult6 = msyql_query("UPDATE computer_process_ids SET timestamp='$Timestamp' WHERE computer_id='$CompID' AND process_id='$ProcID' AND process_info_id='$ProcInfoID'") or die ("ID update for processes failed, please contact your site administrator.\n".logErrors('processes',mysql_error(),$ComputerCount));
}
  } elseif ($ProcCount2 == 1) {
$ProcInfoRow = mysql_fetch_row($ProcResult3);
$ProcInfoID = $ProcInfoRow[0];
$ProcResult5 = mysql_query("SELECT * FROM computer_process_ids WHERE computer_id='$CompID' AND process_id='$ProcID' AND process_info_id='$ProcInfoID'") or die ("ID selection for processes failed, please contact your site administrator.\n".logErrors('processes',mysql_error(),$ComputerCount));
$ProcCount3 = mysql_num_rows($ProcResult5);
if ($ProcCount3 == 0) {
$ProcResult5 = mysql_query("INSERT INTO computer_process_ids (computer_id,process_id,process_info_id,timestamp) VALUES('$CompID','$ProcID','$ProcInfoID','$Timestamp')") or die("Process ID insert failed(4), please contact your site administrator.\n Timestamp: $Timestamp \n Hostname: $HostName \n".logErrors('processes',mysql_error(),$ComputerCount));
} else {
$ProcResult6 = mysql_query("UPDATE computer_process_ids SET timestamp='$Timestamp' WHERE computer_id='$CompID' AND process_id='$ProcID' AND process_info_id='$ProcInfoID'") or die ("ID update for processes failed, please contact your site administrator.\n$Timestamp\n".logErrors('processes',mysql_error(),$ComputerCount));
}
  } else {
fwrite(STDOUT, "An unexpected error occurred while trying to process the processes for $HostName.\n");
  }
}
  }
} else {
fwrite(STDOUT, "The array for 'Process' information could not be created on $INIFile.\n");
}


if (is_array($ini_array['Programs'])) {
  # Iterate all programs that are running when the user logs on, verify that they exist in the DB, or write them to the database
  foreach ($ini_array['Programs'] as $Prog) {
list($ProgName,$ProgPath,$ProgVersion,$ProgPublisher) = explode("*",$Prog);
$ProgResult = mysql_query("SELECT * FROM programs WHERE name='$ProgName'") or die("Program verification query failed, please contact your site administrator. Reported Error:  ".mysql_error()."\n");
$ProgCount = mysql_num_rows($ProgResult);
if ($ProgCount == 0) {
  $ProgResult2 = mysql_query("INSERT INTO programs (name) VALUES('$ProgName')") or die("Program SQL INSERT failed for $ProgName, please contact your site administrator Reported Error:  ".mysql_error()."\n");
  $ProgID = mysql_insert_id();
  $ProgResult3 = mysql_query("SELECT * FROM program_info WHERE path='$ProgPath' AND version = '$ProgVersion' AND publisher='$ProgPublisher'") or die("Program information query failed, please contact your site administrator. Reported Error:  ".mysql_error()."\n");
  $ProgCount2 = mysql_num_rows($ProgResult3);
  if ($ProgCount2 == 0) {
$ProgResult4 = mysql_query("INSERT INTO program_info (path,version,publisher) VALUES('$ProgPath','$ProgVersion','$ProgPublisher')") or die("Program information insert failed, please contact your site administrator.\n".mysql_error());
$ProgInfoID = mysql_insert_id();
$ProgResult5 = mysql_query("INSERT INTO computer_program_ids (computer_id,program_id,program_info_id,timestamp) VALUES('$CompID','$ProgID','$ProgInfoID','$Timestamp')") or die("Program ID insert failed(1), please contact your site administrator.\n".mysql_error());
  } elseif ($ProgCount2 == 1) {
$ProgInfoRow = mysql_fetch_row($ProgResult3);
$ProgInfoID = $ProgInfoRow[0];
$ProgResult5 = mysql_query("SELECT * FROM computer_program_ids WHERE computer_id='$CompID' AND program_id='$ProgID' AND program_info_id='$ProgInfoID'") or die ("ID selection for programes failed, please contact your site administrator.\n".mysql_error());
$ProgCount3 = mysql_num_rows($ProgResult5);
if ($ProgCount3 == 0) {
$ProgResult5 = mysql_query("INSERT INTO computer_program_ids (computer_id,program_id,program_info_id,timestamp) VALUES('$CompID','$ProgID','$ProgInfoID','$Timestamp')") or die("Progess ID insert failed(2), please contact your site administrator.\n".mysql_error());
} else {
$ProgResult6 = msyql_query("UPDATE computer_program_ids SET timestamp='".strtotime("now")."' WHERE computer_id='$CompID' AND program_id='$ProgID' AND program_info_id='$ProgInfoID'") or die ("ID update for programes failed, please contact your site administrator.\n$Timestamp\n".mysql_error());
}
  } else {
fwrite(STDOUT, "An unexpected error occurred while trying to process the programs for $HostName.\n");
  }
} elseif ($ProgCount == 1) {
  #fwrite(STDOUT, "Program $ProgName has already been added to the database.\n";
  $ProgIDRow = mysql_fetch_row($ProgResult);
  $ProgID = $ProgIDRow[0];
  $ProgResult3 = mysql_query("SELECT * FROM program_info WHERE path='$ProgPath' AND version = '$ProgVersion' AND publisher='$ProgPublisher'") or die("Program information query failed, please contact your site administrator. Reported Error:  ".mysql_error()."\n");
  $ProgCount2 = mysql_num_rows($ProgResult3);
  if ($ProgCount2 == 0) {
$ProgResult4 = mysql_query("INSERT INTO program_info (path,version,publisher) VALUES('$ProgPath','$ProgVersion','$ProgPublisher')") or die("Program information insert failed, please contact your site administrator.\n".mysql_error());
$ProgInfoID = mysql_insert_id();
$ProgResult5 = mysql_query("SELECT * FROM computer_program_ids WHERE computer_id='$CompID' AND program_id='$ProgID' AND program_info_id='$ProgInfoID'") or die ("ID selection for programes failed, please contact your site administrator.\n".mysql_error());
$ProgCount3 = mysql_num_rows($ProgResult5);
if ($ProgCount3 == 0) {
$ProgResult5 = mysql_query("INSERT INTO computer_program_ids (computer_id,program_id,program_info_id,timestamp) VALUES('$CompID','$ProgID','$ProgInfoID','$Timestamp')") or die("Progess ID insert failed(3), please contact your site administrator.\n".mysql_error());
} else {
$ProgResult6 = msyql_query("UPDATE computer_program_ids SET timestamp='".strtotime("now")."' WHERE computer_id='$CompID' AND program_id='$ProgID' AND program_info_id='$ProgInfoID'") or die ("ID update for programes failed, please contact your site administrator.\n$Timestamp\n".mysql_error());
}
  } elseif ($ProgCount2 == 1) {
$ProgInfoRow = mysql_fetch_row($ProgResult3);
$ProgInfoID = $ProgInfoRow[0];
$ProgResult5 = mysql_query("SELECT * FROM computer_program_ids WHERE computer_id='$CompID' AND program_id='$ProgID' AND program_info_id='$ProgInfoID'") or die ("ID selection for programes failed, please contact your site administrator.\n".mysql_error());
$ProgCount3 = mysql_num_rows($ProgResult5);
if ($ProgCount3 == 0) {
$ProgResult5 = mysql_query("INSERT INTO computer_program_ids (computer_id,program_id,program_info_id,timestamp) VALUES('$CompID','$ProgID','$ProgInfoID','$Timestamp')") or die("Progess ID insert failed(4), please contact your site administrator.\n".mysql_error());
} else {
$ProgResult6 = mysql_query("UPDATE computer_program_ids SET timestamp='".strtotime("now")."' WHERE computer_id='$CompID' AND program_id='$ProgID' AND program_info_id='$ProgInfoID'") or die ("ID update for programes failed, please contact your site administrator.\n$Timestamp\n".mysql_error());
}
  } else {
fwrite(STDOUT, "An unexpected error occurred while trying to process the programs for $HostName.\n");
  }
}
  }
} else {
fwrite(STDOUT, "The array for 'Program' information could not be created on $INIFile.\n");
}


if (is_array($ini_array['Services'])) {
  # Iterate all programs that are running when the user logs on, verify that they exist in the DB, or write them to the database
  foreach ($ini_array['Services'] as $Serv) {
list($ServName,$ServDisplayName,$ServPath,$ServStartupType,$ServStatus,$ServAuthority) = explode("*",$Serv);
$ServResult = mysql_query("SELECT * FROM services WHERE name='$ServName' AND display_name='$ServDisplayName'") or die("Service verification query failed, please contact your site administrator. Reported Error:  ".logErrors('services',mysql_error(),$ComputerCount)."\n");
$ServCount = mysql_num_rows($ServResult);
if ($ServCount == 0) {
  $ServResult2 = mysql_query("INSERT INTO services (name,display_name) VALUES('$ServName','$ServDisplayName')") or die("Service SQL INSERT failed for $ServName, please contact your site administrator Reported Error:  ".logErrors('services',mysql_error(),$ComputerCount)."\n");
  $ServID = mysql_insert_id();
  $ServResult3 = mysql_query("SELECT * FROM service_info WHERE path='$ServPath' AND startup_type = '$ServStartupType' AND status='$ServStatus' AND authority='$$ServAuthority'") or die("Service information query failed, please contact your site administrator. Reported Error:  ".logErrors('services',mysql_error(),$ComputerCount)."\n");
  $ServCount2 = mysql_num_rows($ServResult3);
  if ($ServCount2 == 0) {
$ServResult4 = mysql_query("INSERT INTO service_info (path,startup_type,status,authority) VALUES('$ServPath','$ServStartupType','$ServStatus','$$ServAuthority')") or die("Service information insert failed, please contact your site administrator.\n".logErrors('services',mysql_error(),$ComputerCount));
$ServInfoID = mysql_insert_id();
$ServResult5 = mysql_query("INSERT INTO computer_service_ids (computer_id,service_id,service_info_id,timestamp) VALUES('$CompID','$ServID','$ServInfoID','$Timestamp')") or die("Service ID insert failed(1), please contact your site administrator.\n".logErrors('services',mysql_error(),$ComputerCount));
  } elseif ($ServCount2 == 1) {
$ServInfoRow = mysql_fetch_row($ServResult3);
$ServInfoID = $ServInfoRow[0];
$ServResult5 = mysql_query("SELECT * FROM computer_service_ids WHERE computer_id='$CompID' AND service_id='$ServID' AND service_info_id='$ServInfoID'") or die ("ID selection for servicees failed, please contact your site administrator.\n".logErrors('services',mysql_error(),$ComputerCount));
$ServCount3 = mysql_num_rows($ServResult5);
if ($ServCount3 == 0) {
$ServResult5 = mysql_query("INSERT INTO computer_service_ids (computer_id,service_id,service_info_id,timestamp) VALUES('$CompID','$ServID','$ServInfoID','$Timestamp')") or die("Servess ID insert failed(3), please contact your site administrator.\n".logErrors('services',mysql_error(),$ComputerCount));
} else {
$ServResult6 = msyql_query("UPDATE computer_service_ids SET timestamp='$Timestamp' WHERE computer_id='$CompID' AND service_id='$ServID' AND service_info_id='$ServInfoID'") or die ("ID update for servicees failed, please contact your site administrator.\n".logErrors('services',mysql_error(),$ComputerCount));
}
  } else {
fwrite(STDOUT, "An unexpected error occurred while trying to process the service for $HostName.\n");
  }
} elseif ($ServCount == 1) {
  #fwrite(STDOUT, "Program $ProgName has already been added to the database.\n";
  $ServIDRow = mysql_fetch_row($ServResult);
  $ServID = $ServIDRow[0];
  $ServResult3 = mysql_query("SELECT * FROM service_info WHERE path='$ServPath' AND startup_type = '$ServStartupType' AND status='$ServStatus' AND authority='$$ServAuthority'") or die("Service information query failed, please contact your site administrator. Reported Error:  ".logErrors('services',mysql_error(),$ComputerCount)."\n");
  $ServCount2 = mysql_num_rows($ServResult3);
  if ($ServCount2 == 0) {
$ServResult4 = mysql_query("INSERT INTO service_info (path,startup_type,status,authority) VALUES('$ServPath','$ServStartupType','$ServStatus','$$ServAuthority')") or die("Service information insert failed, please contact your site administrator.\n".logErrors('services',mysql_error(),$ComputerCount));
$ServInfoID = mysql_insert_id();
$ServResult5 = mysql_query("SELECT * FROM computer_service_ids WHERE computer_id='$CompID' AND service_id='$ServID' AND service_info_id='$ServInfoID'") or die ("ID selection for servicees failed, please contact your site administrator.\n".logErrors('services',mysql_error(),$ComputerCount));
$ServCount3 = mysql_num_rows($ServResult5);
if ($ServCount3 == 0) {
$ServResult5 = mysql_query("INSERT INTO computer_service_ids (computer_id,service_id,service_info_id,timestamp) VALUES('$CompID','$ServID','$ServInfoID','$Timestamp')") or die("service ID insert failed(3), please contact your site administrator.\n".logErrors('services',mysql_error(),$ComputerCount));
} else {
$ServResult6 = msyql_query("UPDATE computer_service_ids SET timestamp='$Timestamp' WHERE computer_id='$CompID' AND service_id='$ServID' AND service_info_id='$ServInfoID'") or die ("ID update for servicees failed, please contact your site administrator.\n".logErrors('services',mysql_error(),$ComputerCount));
}
  } elseif ($ServCount2 == 1) {
$ServInfoRow = mysql_fetch_row($ServResult3);
$ServInfoID = $ServInfoRow[0];
$ServResult5 = mysql_query("SELECT * FROM computer_service_ids WHERE computer_id='$CompID' AND service_id='$ServID' AND service_info_id='$ServInfoID'") or die ("ID selection for servicees failed, please contact your site administrator.\n".logErrors('services',mysql_error(),$ComputerCount));
$ServCount3 = mysql_num_rows($ServResult5);
if ($ServCount3 == 0) {
$ServResult5 = mysql_query("INSERT INTO computer_service_ids (computer_id,service_id,service_info_id,timestamp) VALUES('$CompID','$ServID','$ServInfoID','$Timestamp')") or die("service ID insert failed(4), please contact your site administrator.\n".logErrors('services',mysql_error(),$ComputerCount));
} else {
$ServResult6 = mysql_query("UPDATE computer_service_ids SET timestamp='$Timestamp' WHERE computer_id='$CompID' AND service_id='$ServID' AND service_info_id='$ServInfoID'") or die ("ID update for servicees failed, please contact your site administrator.\n$Timestamp\n".logErrors('services',mysql_error(),$ComputerCount));
}
  } else {
fwrite(STDOUT, "An unexpected error occurred while trying to process the services for $HostName.\n");
  }
}
  }
} else {
fwrite(STDOUT, "The array for 'Service' information could not be created on $INIFile.\n");
}



if (is_array($ini_array['LLU'])) {
  # Iterate all users who logged into the particular hostname; query the database to make sure that user has an entry in the database
  foreach ($ini_array['LLU'] as $key => $val) {
$LLUResult = mysql_query("SELECT * FROM usernames WHERE username='$val'") or die("Username verification query failed, please contact your site administrator. Reported Error:  ".logErrors('LLU',mysql_error(),$ComputerCount)."\n");
$LLUCount = mysql_num_rows($LLUResult);
# If 0 results, create the user account in the usernames table and also add the corresponding entry to associate the userid with the computerid
if ($LLUCount == 0) {
  $LLUResult2 = mysql_query("INSERT INTO usernames (username) VALUES('$val')") or die("Last Logged on User (LLU) SQL INSERT failed for $val, please contact your site administrator Reported Error:  ".logErrors('LLU',mysql_error(),$ComputerCount)."\n");
  $LLUID = mysql_insert_id();
  $LLUResult3 = mysql_query("INSERT INTO computer_username_ids (computer_id,username_id,timestamp) VALUES('$CompID','$LLUID','$key')") or die("Computer -> Username ID INSERT failed, please contact your site administrator. Reported Error:  ".logErrors('LLU',mysql_error(),$ComputerCount)."\n");
  # If the username queried for is in the correct table, check to see if the exact entries exist in the userid/computerid table and if it does NOT, write it to the DB
} elseif ($LLUCount == 1) {
  #fwrite(STDOUT, "User $val has already been added to the database.\n";
  $LLUIDResult2 = mysql_query("SELECT id FROM usernames WHERE username='$val'") or die("Computer ID selection failed, please contact your site administrator. Reported Error:  ".logErrors('LLU',mysql_error(),$ComputerCount)."\n");
  $LLUIDRow = mysql_fetch_row($LLUIDResult2);
  $LLUID = $LLUIDRow[0];
  $LLUResult3 = mysql_query("SELECT * FROM computer_username_ids WHERE username_id='$LLUID' AND computer_id='$CompID' AND timestamp='$key'") or die("Last logged on user query failed, please contact your site administrator. Reported Error:  ".logErrors('LLU',mysql_error(),$ComputerCount)."\n");
  $LLUCount3 = mysql_num_rows($LLUResult3);
  if ($LLUCount3 == 0) {
$LLUResult4 = mysql_query("INSERT INTO computer_username_ids (computer_id,username_id,timestamp) VALUES('$CompID','$LLUID','$key')") or die("Computer -> Username ID INSERT-2 failed, please contact your site administrator. Reported Error:  ".logErrors('LLU',mysql_error(),$ComputerCount)."\n");
  } elseif ($LLUCount3 == 1) {
#fwrite(STDOUT, "$val has already been entered into the database for the script being run.\n";
  } else {
fwrite(STDOUT, "DATABASE ERROR:  Multiple records exist for that username, computer, and time; halting script execution!\n");
exit;
  }  
} else {
  fwrite(STDOUT, "DATABASE ERROR:  Multiple records for $val already exist in the database!  Halting script execution.\n");
  exit;
}
  }
} else {
fwrite(STDOUT, "The array for 'Last Logged on User' information could not be created on $INIFile.\n");
}

#fwrite(STDOUT, "\n\n";
$ComputerCount++;
if (file_exists($INIPath.$INIFile)) unlink($INIPath.$INIFile);
}
}
}
  # Report an error if the opening of the INI file directory fails
  } else {
    fwrite(STDOUT, "Error Opening Directory:  " . $INIPath . "\n");
  }
# Report an error if the variable is not a directory
} else {
  fwrite(STDOUT,"There were no computers that needed to be updated.\n");
}

$ScriptEndTime = microtime_float();
$ScriptRunTime = $ScriptEndTime - $ScriptStartTime;

$ScriptSQL = "INSERT INTO script_execution (timestamp,number_of_computers,scriptruntime) VALUES('".strtotime("now")."','$ComputerCount','".round($ScriptRunTime)."')";
$ScriptResult = mysql_query($ScriptSQL) or die("Script logging function failed, please contact your administrator.\n $ScriptSQL \n".logErrors('SQL',mysql_error(),$ComputerCount));

fwrite(STDOUT, "Computers Processed:  $ComputerCount\n");
fwrite(STDOUT, "Script Execution Completed \n");


# Close the opened database
db_close();

exit(0);

?>[/code]

Share this post


Link to post
Share on other sites
you may want to try LOAD DATA INFILE. It's a lot faster than INSERTs.

Share this post


Link to post
Share on other sites
i'll have to look at that because since my information is in INI files and in a specified format with the way the info is gathered, i'll have to rewrite the whole PHP script to write the specific table-based information into a temp .txt file so that LOAD DATA INFILE can parse the information correctly.  It will be a task but if you think it will work.  do you know of any good tutorials on using this so that i don't have to fumble through it myself?  thanx in advance.

Share this post


Link to post
Share on other sites
Yeah, maybe if you could format the files slightly differently so that they can be loaded into MySQL.
Also, while possibly not your favourite option you could consider using something like Python if it's going to be running for a long time, the speed increase might help.

Share this post


Link to post
Share on other sites
Perl is also a good text processing language.

on a side note, if it's going to be a pain to rewrite the whole script, try INSERT INTO ... ON DUPLICATE KEY UPDATE. It saves you 2 queries each time. or take advantage of the multiple VALUES syntax.

Share this post


Link to post
Share on other sites
thank you for the suggestions guys but also try to remmeber that it's not my text processing that's my short-fall, it's my mysql queries that are bogging down the process.. i'll have to try some of those mysql suggestions that you all have given.  thank you again.

Share this post


Link to post
Share on other sites
That's a lot of data and I'd suggest you go at this a different way.

From what you've posted, if you were to go through each value/line in the ini files as you're doing. Even if you performed [b]one[/b] query for each value you'd end up doing about 500,000 queries when processing 1500 ini files and about 1 million if you processed 3000(This is based on the example file). Now multiply that by the number of queries that the script is currently running for each line.


MYSQL can do a lot if given the data. So what I'd first suggest is to dump the values in the ini files into temporary tables and work with those.

The basic thing you need to do first is this.

Create the following temporary tables at the beginning of the script. Do not add any indexes
[code]
processes_tmp //should have a compID column and all the columns in "processes" and "process_info" except the id columns

programs_tmp //should have a compID column and all the columns in "programs " and "program_info" except the id columns

services_tmp //should have a compID column and all the columns in "services" and "service_info" except the id columns

usernames_tmp //This can be left for later.
[/code]

Once you've done that you'll need to populate them with all the values you were splitting across the multple tables.

You can use the multiple VALUES syntax for this as ryanlwh suggested, but you can use seperate inserts for the time being. Yes, we're takingf the 500,000/1mil query hit at the beginning. The reason I'm not pushing you to use the other syntax is because I haven't noticed much of a speed difference when I've tested it. We can test it later.

After you've written that part of the script, post it and post the time it takes to populate the tables.

I also noticed that you don't have any method of ensuring that the script isn't already running. Meaning that the script is run every 5 mins even if another one is still being run? If so, you can work on changing that after the script is finished.

Share this post


Link to post
Share on other sites
Let me clarify part of how to dump the data.

Put a unique index on the hostname column
[code]
ALTER TABLE computers ADD UNIQUE(hostname);
[/code]

Now when going through the ini files you'll insert and get the compID of the current computer using the following. Note the syntax ("INSERT INTO ... ON DUPLICATE KEY UPDATE" as mentioned by ryanlwh).
[code]
$sql = "INSERT INTO "
        ."computers "
        ."(hostname,ip,mac,os,os_ver,scriptruntime)  "
        ."VALUES "
        ."('$Hostname','$IP','$MAC','$OS','$Ver','$ScriptRunTime') "
        ."ON DUPLICATE KEY "
        ."UPDATE "
        ."hostname='$Hostname', ip='$IP', mac='$MAC', os='$OS', os_ver='$VER', scriptruntime='$ScriptRunTime' ";
$result = mysql_query($sql) or die("SQL query failed on $hostname. Reported Error:  ".logErrors('general',mysql_error(),$ComputerCount)."\n");

$CompID = mysql_insert_id();
[/code]
You'd then use this compID when populating the tables.

EDIT: The explanation of dumping the ini data is on page1 of the thread

Share this post


Link to post
Share on other sites
wow thanx for all of the information guys.  i guess i have some work to do and i'll post the content once i get it up and working but it might be a couple of days as i'm in a cisco class right now and only have my breaks to come back to the office to look at this stuff; and because this is all new to me, i'm sure i'll be fumbling through the syntax and stuff.  thanx so much for the help everyone.  i'll give it a shot. 

Shoz:  you mentioned a problem i'm having with my PHP script running every 5 mins.  I agree, this is a seriuos problem because of the length of time it takes for the script to run AND how my directory array is created.  I noticed that when multiple PHP scripts run, the scripts oftentimes try to update the same INI file after a while and almost become in sync so two scripts are fighting each other over finishing the INI file first.  I tried to a rudimentary method of attempting to fix this but have come to the problem just aforementioned.  you see, the script used to try to open files that had already been deleted.  thus, i added the if(is_file)) syntax to check the existence in case one of the PHP scripts had already completed operation on the INI file.  I can't think of how to split up processing of the INI files more efficiently.  If I can get a good method for accomplishing that down as well as a way to fork my process, i might be able to spawn 10 processes simultaneously to increase the processing efficiency.  your thoughts?

Share this post


Link to post
Share on other sites
[quote=thepip3r]
I can't think of how to split up processing of the INI files more efficiently.  If I can get a good method for accomplishing that down as well as a way to fork my process, i might be able to spawn 10 processes simultaneously to increase the processing efficiency.  your thoughts?
[/quote]
Until this lone script can go through the files in a decent amount of time, I wouldn't think about splitting up processing in any way.

To stop the script from running if it's already being run, you can create a basic lock file scenario for the time being. When the script is run it checks if the lock file exists. If it does, it exits. If not, it creates it and continues execution. You may want to use [url=http://www.php.net/register_shutdown_function]register_shutdown_function[/url] to do the cleanup.

While you're writing the script, consider writing two. One that uses the tmp tables and the other that goes through the list as you were doing, but with changes similar to the change to insert the hostname. Both methods should be much faster after the queries are changed and indexes created, but if you're going from 17hrs you should invest the time in trying both.

eg: The first half would now look like the following.
[code]
$ScriptStartTime = microtime_float();
db_open();

$INIPath = "e:\\inventory_agent\\data\\INIs\\";
$ComputerCount = 1;

if (is_dir($INIPath)) {
  if ($INIDH = opendir($INIPath)) {
    while (($INIFile = readdir($INIDH)) !== false) {
  $INISub = SubStr($INIFile,-4,4);
  $HostName = SubStr($INIFile,0,StrLen($INIFile)-4);
 
  if ($INISub == '.ini') {
if (is_file($INIPath.$INIFile)) {
  $ini_array = parse_ini_file($INIPath.$INIFile, true);
          $Timestamp = $ini_array['General']['Timestamp'];
 
# Write each elements section and value to it's own variable name and value
if (is_array($ini_array['General'])) {
  foreach ($ini_array['General'] as $key => $val) {
$$key = $val;
  }

$sql = "INSERT INTO "
                                        ."computers "
                                        ."(hostname,ip,mac,os,os_ver,scriptruntime)  "
                                        ."VALUES "
                                        ."('$Hostname','$IP','$MAC','$OS','$Ver','$ScriptRunTime') "
                                        ."ON DUPLICATE KEY "
                                        ."UPDATE "
                                        ."hostname='$Hostname', ip='$IP', mac='$MAC', os='$OS', os_ver='$VER', scriptruntime='$ScriptRunTime' ";
                                $result = mysql_query($sql) or die("SQL query failed on $hostname. Reported Error:  ".logErrors('general',mysql_error(),$ComputerCount)."\n");

                                $CompID = mysql_insert_id();
[/code]

The general idea behind the tmp tables is this
[code]
populate tmp tables

INSERT INTO SELECT JOIN etc ON UPDATE column=VALUES(col) etc
INSERT INTO SELECT JOIN etc ON UPDATE etc
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.