Revise Exec Path Check in ExtractPrograms.ps1

This commit is contained in:
Rohan Barar 2024-09-02 12:15:02 +10:00
parent e224e233cc
commit 3a0acff38f

View File

@ -180,6 +180,7 @@ function AppSearchWinReg {
# Initialise empty arrays. # Initialise empty arrays.
$exeNames = @() $exeNames = @()
$exePaths = @() $exePaths = @()
$validPaths = @()
# Query windows registry for unique installed executable files. # Query windows registry for unique installed executable files.
$exePaths = Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\*" | $exePaths = Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\*" |
@ -193,12 +194,13 @@ function AppSearchWinReg {
# Get corresponding application names for unique installed executable files. # Get corresponding application names for unique installed executable files.
foreach ($exePath in $exePaths) { foreach ($exePath in $exePaths) {
if (Test-Path -Path $exePath) { if (Test-Path -Path $exePath) {
$validPaths += $exePath
$exeNames += GetApplicationName -exePath $exePath $exeNames += GetApplicationName -exePath $exePath
} }
} }
# Process extracted executable file paths. # Process extracted executable file paths.
PrintArrayData -Names $exeNames -Paths $exePaths -Source "winreg" PrintArrayData -Names $exeNames -Paths $validPaths -Source "winreg"
} }
# Name: 'AppSearchUWP' # Name: 'AppSearchUWP'