$SavePath = "$($env:USERPROFILE)\Desktop\Process_Report.txt"
$RunningProcesses = [System.Diagnostics.Process]::GetProcesses()
$InstalledApplications = Get-Package
Out-File -FilePath $SavePath -InputObject "Process Count: $($RunningProcesses.Count)" -Append -Encoding ascii
Out-File -FilePath $SavePath -InputObject "Installed App Count: $($InstalledApplications.Count)`n`n" -Append -Encoding ascii
foreach ($Process in $RunningProcesses)
{
$ProcessHash = $null
if($Process.MainModule.FileName)
{
$ProcessHash = Get-FileHash -Path $Process.MainModule.FileName
}
else
{
$ProcessHash = "Could not determine path"
}
Out-File -FilePath $SavePath -InputObject "$($Process.Name) -- $ProcessHash -- $($Process.MainModule.FileName)" -Append -Encoding ascii
}
$InstalledApplications | select * | % { Out-File -FilePath $SavePath -InputObject $_ -Append -Encoding ascii }