获取文件版本信息,通过FileVersionInfo::GetVersioninfo(file) 来获取信息
function Check-DdpstoreFileVersion
{
$DdpstorePath = Join-Path $Env:windir "System32Ddpstore.dll"
if(Test-Path $DdpstorePath)
{
$DdpStoreFileVersionObj = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($DdpstorePath)
if($DdpStoreFileVersionObj)
{
$DdpStoreFileVersion = "{0}.{1}.{2}.{3}" -f $DdpStoreFileVersionObj.FileMajorPart,$DdpStoreFileVersionObj.FileMinorPart,$DdpStoreFileVersionObj.FileBuildPart,$DdpStoreFileVersionObj.FilePrivatePart
$scriptenv.IsRequiredUpdateForDdpstoreEnv = [version]$DdpStoreFileVersion -lt [version]"6.2.9200.20842"
}
}
}