Skip to content

Instantly share code, notes, and snippets.

@farzinenddo
Created November 9, 2020 01:06
Show Gist options
  • Save farzinenddo/1bb274f5d5227a408e0503a66fd053ab to your computer and use it in GitHub Desktop.
Save farzinenddo/1bb274f5d5227a408e0503a66fd053ab to your computer and use it in GitHub Desktop.
Finding .Net Binary
function Get-PEMetaData {
[CmdletBinding()]
param($Path)
try {
$FullPath = Resolve-Path -Path $Path -ErrorAction Stop
try {
$Null = [Reflection.AssemblyName]::GetAssemblyName($FullPath)
$Signature = Get-AuthenticodeSignature -FilePath $FullPath -ErrorAction SilentlyContinue
if ($Signature -and ($Signature.Status -eq 'NotSigned')) {
write-host $Path "NotSigned"
}
else {
write-host $Path "Signed"
}
}
catch {
;
}
}
catch {
Write-Warning "Unable to resolve path: $Path"
}
}
$base = "C:\windows"
Get-ChildItem -Path $base -Filter *.exe -Recurse -File -Name| ForEach-Object {
Get-PEMetaData -Path ($base + "\" + $_)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment