我想知道AV Mcafee和Endpoint代理的版本,很明显,我在ePo控制台上没有连接。
我得到了这个脚本:
$AgentVer = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey("LocalMachine",$Computer).OpenSubKey('HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\McAfee\AgentVersion').GetValue('AgentVersion')
$ProductVer = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine',$Computer).OpenSubKey('HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\McAfee\SystemCore').GetValue('')
" $AgentVer Agent version: $AgentVer
$computer Product version: $ProductVer
但是执行时我得到:
You cannot call a method on a null-valued expression. At line:2 char:1 + $AgentVer = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey("LocalMa ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull You cannot call a method on a null-valued expression. At line:3 char:1 + $ProductVer = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('Local ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull Agent version: 10.1.1.1 Product version:
我不知道该怎么做,有什么可以帮助我的吗?
问候和感谢
答案 0 :(得分:0)
您已经在LocalMachine
调用中指定了注册表配置单元OpenRemoteBaseKey
,因此不应在OpenSubKey
的参数中重复它。另外,您应该只给OpenSubKey
分配子项路径,而不是值的全名。这应该起作用:
$hklm = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey("LocalMachine", $Computer)
$subkey = $hklm.OpenSubKey("SOFTWARE\Wow6432Node\McAfee")
$AgentVer = $subkey.GetValue("AgentVersion")
$ProductVer = $subkey.GetValue("SystemCore")