Skip to content

Instantly share code, notes, and snippets.

@jedieaston
Created October 19, 2021 19:15
Show Gist options
  • Save jedieaston/edd6f1983108c1c220bbf6d9d18d3c4c to your computer and use it in GitHub Desktop.
Save jedieaston/edd6f1983108c1c220bbf6d9d18d3c4c to your computer and use it in GitHub Desktop.
Figure out what new ARP entries there are.
function Get-ARPTable {
$registry_paths = @('HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*','HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*', 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*', 'HKCU:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*')
return Get-ItemProperty $registry_paths -ErrorAction SilentlyContinue |
Select-Object DisplayName, DisplayVersion, Publisher, @{N='ProductCode'; E={$_.PSChildName}}|
Where-Object {$null -ne $_.DisplayName } |
Where-Object {$null -ne $_.DisplayVersion } |
Where-Object {$null -ne $_.Publisher }
}
# See how the ARP table changes before and after a ScriptBlock.
function Get-ARPTableDifference {
Param (
[Parameter(Mandatory=$true)]
[scriptblock]
$ScriptToRun
)
$originalArp = Get-ARPTable
$ScriptToRun | Invoke-Expression
$currentArp = Get-ARPTable
return (Compare-Object $currentArp $originalArp).InputObject
}
# Example usage:
# Get-ARPTableDifference { winget install Microsoft.Teams; }
# Returns:
# DisplayName DisplayVersion Publisher ProductCode
# ----------- -------------- --------- -----------
# Microsoft Teams 1.4.00.26376 Microsoft Corporation Teams
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment