Users can easily add running process information to the project report using ProScript however; there is currently no method to add each processes dependant DLL and library information. Since the dependence information is available to ProScript users can simply create a separate report with the desired information. The following script will do just that:
#--------------------------------------------------------------------------------------------
# GetProcessesAndDepend.pl, version 1.0
# ProScript to Get Processes and depends info and output to file.
# Note: you must be connected to a remote system for this script to work properly.
#
# History: 10/14/2009 Christopher L. T. Brown - Original Script
#-------------------------------------------------------------------------------------------
use ProScript;
##############################################################################
###Change this value to desired location for output of the prefech data
$ProcessAndDependsList = "C:\\ProDiscover\\ProScript\\Output\\ProcessAndDependsList.txt";
##############################################################################
open(FP,">$ProcessAndDependsList");
PSDisplayText("GetProcessAndDependsList.pl v. 1.0");
print FP "GetProcessAndDependsList.pl v. 1.0 \n";
PSPrint("~ Getting Process List", PS_BLUE , TRUE);
print FP "Getting Process List \n";
$pHandle = PSGetProcessList();
if ($pHandle == 0)
{
PSPrint("Error Getting Process List", PS_RED, FALSE);
print FP "Error Getting Process List \n";
exit;
}
else
{
PSPrint("~ Finished Getting Process List", PS_GREEN, FALSE);
print FP "Finished Getting Process List \n \n";
}
PSPrint("~ Getting Process Count.", PS_BLUE , TRUE);
print FP " Getting Process Count. \n";
$NumProc = PSGetProcessesCount($pHandle);
$count = "$NumProc processes found!";
PSDisplayText($count);
print FP "$NumProc processes found! \n \n";
for($nIndex=0; $nIndex {
$objRef = ProScript::PSGetProcessInfo($pHandle, $nIndex);
PSDisplayText("Process Name: $objRef->{ProcName}");
print FP "Process Name: $objRef->{ProcName} \n";
PSDisplayText("Process Id: $objRef->{ProcID}");
print FP "Process Id: $objRef->{ProcID} \n";
PSDisplayText("PID of Parent Process: $objRef->{ParentPID}");
print FP "PID of Parent Process: $objRef->{ParentPID} \n";
PSDisplayText("Company Name: $objRef->{CompanyName}");
print FP "Company Name: $objRef->{CompanyName} \n";
PSDisplayText("Start time of the Process: $objRef->{ProcStartTime}");
print FP "Start time of the Process: $objRef->{ProcStartTime} \n";
PSDisplayText("Ram Usage: $objRef->{ProcRAMUsage}");
print FP "Ram Usage: $objRef->{ProcRAMUsage} \n";
PSDisplayText("Desc: $objRef->{Description}");
print FP "Desc: $objRef->{Description} \n\n";
PSPrint("~ Geting Dependencies", PS_BLUE , TRUE);
print FP "Geting Dependencies \n";
@DllInfo = ProScript::PSGetProcessDependsInfo($pHandle, $nIndex);
$len =@DllInfo;
PSPrint("~ $len Dependencies Found.", PS_GREEN , FALSE);
print FP "$len Dependencies Found. \n\n";
foreach $item (@DllInfo)
{
PSDisplayText("Dll Name: $item->{DllName}");
print FP "Dll Name: $item->{DllName} \n";
PSDisplayText("Dll Version: $item->{DllVersion}");
print FP "Dll Version: $item->{DllVersion} \n";
PSDisplayText("Dll CompName: $item->{ DllCompName}");
print FP "Dll CompName: $item->{ DllCompName} \n";
PSDisplayText("Dll Path: $item->{DllPath}");
print FP "Dll Path: $item->{DllPath} \n";
PSDisplayText("Dll CompName: $item->{DllDescription}");
print FP "Dll CompName: $item->{DllDescription} \n\n";
}
}
PSAddProcessInfoToReport($pHandle, PS_PI_ADD_ALL);
print FP "ProScript Complete \n\n";
PSCloseHandle($pHandle);
close(FP);
################# End Script ##########################