Created
December 29, 2023 01:43
-
-
Save notsle/d3ab265d07957d459a32823e78e802a1 to your computer and use it in GitHub Desktop.
Get-DirHash.ps1
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-DirHash { | |
[Cmdletbinding()] | |
Param( | |
[Parameter(Mandatory=$true)] | |
[ValidateScript({ | |
if(Test-Path -Path $_ -ErrorAction SilentlyContinue) | |
{ | |
return $true | |
} | |
else | |
{ | |
throw "$($_) is not a valid path." | |
} | |
})] | |
[string]$Path | |
) | |
$temp = gci -File -Recurse $Path | Get-FileHash | select -ExpandProperty Hash | Out-String | |
$hash = Get-FileHash -InputStream ([IO.MemoryStream]::new([char[]]$temp)) | |
$hash.Path=$Path | |
return $hash.Hash | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment