您的位置:首页 > 运维架构 > Shell

Powershell 获取文件版本信息

2013-11-21 17:31 225 查看
获取文件版本信息,通过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"
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: