Better appDiff output

This commit is contained in:
Zachary Gorman 2024-07-26 16:04:17 -07:00
parent 774bce8ec7
commit ca45404af1
5 changed files with 74 additions and 12 deletions

38
Data/AppsToIgnore.json Normal file
View file

@ -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"
}
]

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -2,6 +2,13 @@ param (
$examplePC
)
$GetPCNotInstalledApps = @(
"Citrix",
"Microsoft Visual C\+\+",
"RightFax",
"Windows Driver Package"
)
function Get-AppDiff {
param(
[Parameter(Mandatory)]
@ -17,21 +24,24 @@ 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){
$output | Out-GridView -Title "Get-PC Apps - $ComputerName"
@ -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")