0

我正在尝试从注册表项中获取产品版本。在我希望控制台向最终用户显示产品版本的地方有点卡住 - 我不断收到意外的令牌。

我尝试移动引号之类的东西,但仍然无济于事。

我想我需要将“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 }
4

1 回答 1

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" 
}
于 2012-07-06T12:26:59.810 回答