diff --git a/Data/AppsToIgnore.json b/Data/AppsToIgnore.json new file mode 100644 index 0000000..c514c32 --- /dev/null +++ b/Data/AppsToIgnore.json @@ -0,0 +1,38 @@ +[ + { + "DisplayName": "Hyland Web ActiveX Controls" + }, + { + "DisplayName": "Intel(R) Processor Graphics" + }, + { + "DisplayName": "Microsoft Visual Studio Setup WMI Provider (default)" + }, + { + "DisplayName": "NetSupport Manager" + }, + { + "DisplayName": "Office 16 Click-to-Run Localization Component" + }, + { + "DisplayName": "Realtek Audio COM Components (driver)" + }, + { + "DisplayName": "Realtek High Definition Audio Driver" + }, + { + "DisplayName": "Vulkan Run Time Libraries (default)" + }, + { + "DisplayName": "Microsoft Teams Meeting Add-in for Microsoft Office" + }, + { + "DisplayName": "Documentation Manager" + }, + { + "DisplayName": "64 Bit HP CIO Components Installer" + }, + { + "DisplayName": "Teams Machine-Wide Installer" + } +] \ No newline at end of file diff --git a/Data/ExpectedApps.json b/Data/ExpectedApps.json index 3a7e4f9..801c84e 100644 Binary files a/Data/ExpectedApps.json and b/Data/ExpectedApps.json differ diff --git a/Data/ExpectedApps.json.bak b/Data/ExpectedApps.json.bak deleted file mode 100644 index 4fa8b9f..0000000 Binary files a/Data/ExpectedApps.json.bak and /dev/null differ diff --git a/Data/ExpectedApps.txt b/Data/ExpectedApps.txt deleted file mode 100644 index 18f013a..0000000 Binary files a/Data/ExpectedApps.txt and /dev/null differ diff --git a/Private/AppDiff.ps1 b/Private/AppDiff.ps1 index b0e2704..f9861d4 100644 --- a/Private/AppDiff.ps1 +++ b/Private/AppDiff.ps1 @@ -2,6 +2,13 @@ param ( $examplePC ) +$GetPCNotInstalledApps = @( + "Citrix", + "Microsoft Visual C\+\+", + "RightFax", + "Windows Driver Package" +) + function Get-AppDiff { param( [Parameter(Mandatory)] @@ -17,20 +24,23 @@ function Get-AppDiff { # Open example file $lookupTablePath = Join-Path (get-item $PSScriptRoot).Parent.FullName 'Data\ExpectedApps.json' $example = get-content $lookupTablePath | ConvertFrom-Json + # Open file with manually added apps to ignore + $lookupTablePath = Join-Path (get-item $PSScriptRoot).Parent.FullName 'Data\AppsToIgnore.json' + $ignore = get-content $lookupTablePath | ConvertFrom-Json + $exclude = $example + $ignore $output = @() # Finds each app that isn't in the example foreach ( $app in $apps ) { - if ( - # Apps that shouldn't be considered an "installed app" - (-not ($app.DisplayName -match "Citrix")) -and - (-not ($app.DisplayName -match "Microsoft Visual C\+\+")) -and - (-not ($app.DisplayName -match "RightFax")) -and - # This check is last for performance - (-not ( $example.DisplayName -contains $app.DisplayName ) ) - ) - { - $output += $app + $skip = $false + foreach ($notapp in $GetPCNotInstalledApps) { + if ($app.DisplayName -match $notapp) { + $skip = $true + break + } } + if ($skip -or $exclude.DisplayName -contains $app.DisplayName) { continue } + + $output += $app } if($TableView){ @@ -73,9 +83,23 @@ function Copy-FileNoDestruct ($srcpath, $dstpath) { function Get-ExampleApps { param( $examplePC ) $appsPath = (Join-Path (get-item $PSScriptRoot).Parent.FullName 'Private\Apps.ps1') + $sccmPath = (Join-Path (get-item $PSScriptRoot).Parent.FullName 'Private\SCCMQuery.ps1') Import-Module -Force $appsPath - $apps = Get-Apps $examplePC - $apps = Remove-Version $apps + Import-Module -Force $sccmPath + $apps = Get-Apps $examplePC | Select-Object -Property "DisplayName" + $trimmedApps = @() + foreach ($app in $apps) { + $skip = $false + foreach ($notapp in $GetPCNotInstalledApps) { + if (!$app.DisplayName -or $app.DisplayName -match $notapp) { + $skip = $true + break + } + } + if ($skip) { continue } + $trimmedApps += $app + } + $apps = Remove-Version $trimmedApps # Open example file $lookupTablePath = Join-Path (get-item $PSScriptRoot).Parent.FullName 'Data\ExpectedApps.json' Copy-FileNoDestruct $lookupTablePath $($lookupTablePath + ".bak")