Skip to content

Instantly share code, notes, and snippets.

@RichieBzzzt
Created September 14, 2017 22:51
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 RichieBzzzt/bd4109fe3d9e13bb5846c353991a576d to your computer and use it in GitHub Desktop.
Save RichieBzzzt/bd4109fe3d9e13bb5846c353991a576d to your computer and use it in GitHub Desktop.
function Get-DllVersionInfo
{
param
(
[Parameter(Position=0,mandatory=$true)]
[string] $Dll
)
if(!(Test-Path $Dll -PathType leaf))
{
Write-Error -message “The path to $Dll is either not accessible or does not exist”
throw
}
$fileType = [IO.Path]::GetExtension($Dll)
if ($fileType -ne ‘.dll’)
{
Write-Error -Message “The file type at end of $Dll is not a dll.”
throw
}
$VersionInfo = (Get-Item $Dll).VersionInfo
$FileVersion = (“{0}.{1}.{2}.{3}” -f $VersionInfo.FileMajorPart,
$VersionInfo.FileMinorPart,
$VersionInfo.FileBuildPart,
$VersionInfo.FilePrivatePart)
return $FileVersion
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment