我正在尝试从注册表项获取产品版本。在我希望控制台向最终用户显示产品版本的地方有点卡住 - 我继续获得意外的令牌。
我试过移动引号和东西,但仍无济于事。
我想我需要将“if”更改为“$ SEPVersion.ProductVersion -eq”11.0.5002.333“) - 我这样做但我仍然遇到错误。
任何帮助将不胜感激:
$SEPVersion = Get-ItemProperty 'HKLM:\SOFTWARE\Symantec\Symantec Endpoint Protection\SMC' -Name 'ProductVersion' | fl ProductVersion -ErrorAction SilentlyContinue
if ($SEPVersion-eq "11.0.5002.333") {
"SEP Version is correct the version is set to" $SEPVersion
}
else {
"SEP Version is INCORRECT - Please resolve this - the version of SEP is " $SEPVersion }
答案 0 :(得分:1)
尝试一下:
$SEPVersion = (Get-ItemProperty 'HKLM:\SOFTWARE\Symantec\Symantec Endpoint Protection\SMC' -Name 'ProductVersion' -ea SilentlyContinue ).Productversion
if ($SEPVersion -eq "11.0.5002.333")
{
"SEP Version is correct the version is set to $SEPVersion"
}
else
{
"SEP Version is INCORRECT - Please resolve this - the version of SEP is $SEPVersion"
}