Powershell 获取文件版本信息

 

获取文件版本信息,通过FileVersionInfo::GetVersioninfo(file) 来获取信息

function Check-DdpstoreFileVersion
{
 $DdpstorePath = Join-Path $Env:windir "System32\Ddpstore.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"
  }
 }
}

posted @ 2013-11-21 17:31  Binyao  阅读(854)  评论(0编辑  收藏  举报