Environment 获取 OSversion:
$OSVersion = [System.Environment]::OSVersion.Version
WMI获取Caption:
$OSCaption = (Get-WmiObject -class Win32_OperatingSystem).Caption
版本转换获取小版本号[Version]:
$IsWindowsServer2012Env = ([version]$scriptargs.OSVersion).Major -eq 6 -and ([version]$scriptargs.OSVersion).Minor -eq 2 -and $scriptargs.OSCaption -like "*Windows Server 2012 *"
判断hotfix是否安排:
$IsHotfix2896660InstalledEnv =(Get-HotFix | Where-Object{$_.HotFixID -eq "KB2896660"}) -ne $null