Created
September 14, 2017 22:51
-
-
Save RichieBzzzt/bd4109fe3d9e13bb5846c353991a576d to your computer and use it in GitHub Desktop.
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-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