Skip to content

Instantly share code, notes, and snippets.

@mattpodwysocki
Last active July 19, 2018 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattpodwysocki/9a9fa9e9b30e118ecebfae05c22e4f2e to your computer and use it in GitHub Desktop.
Save mattpodwysocki/9a9fa9e9b30e118ecebfae05c22e4f2e to your computer and use it in GitHub Desktop.
function Get-Files($path = $pwd) {
foreach ($item in Get-ChildItem $path) {
if (Test-Path $item.FullName -PathType Container) {
Get-Files $item.FullName
} else {
$item
}
}
}
function Main($path = $pwd) {
$results = @()
$dllResults = @()
foreach ($item in Get-Files -path $path) {
$props = @{
Item = $item.FullName
Hash = (Get-FileHash -Path $item.FullName).Hash
Version = $item.VersionInfo.FileVersion
}
$extn = [IO.Path]::GetExtension($item.FullName)
if ($extn -eq '.dll') {
$dllResults += New-Object psobject -Property $props
}
$results += New-Object psobject -Property $props
}
$results | Export-Csv 'Results.csv' -NoTypeInformation
$dllResults | Export-Csv 'ResultsDll.csv' -NoTypeInformation
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment