Created
October 19, 2021 19:15
-
-
Save jedieaston/edd6f1983108c1c220bbf6d9d18d3c4c to your computer and use it in GitHub Desktop.
Figure out what new ARP entries there are.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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