JEA: Could not get registry values / Cannot validate argument on parameter 'Property'


When JEA is used, Pattern step with Operation "Get Registry Key" may fail, for example: Pattern MSSql DB On Windows, step: 31.2 Port from last connection.

2020-12-01 11:06:11: Error when getting registry value. getRegistryValues : Could not get registry values (*) of base key HKEY_LOCAL_MACHINE and key SOFTWARE\Microsoft\MSSQLServer\Client\SuperSocketNetLib\LastConnect through the remote session. Original Exception: Cannot validate argument on parameter 'Property'. The argument "Property" does not belong to the set "ModuleName,Namespace,OutputType,Count,HelpUri,Name,CommandType,ResolvedCommandName,DefaultParameterSet,CmdletBinding,Parameters" specified by the ValidateSet attribute. Supply an argument that is in the set and then try the command again.
At line:1 char:5
+ & { getRegistryValues -hive "HKEY_LOCAL_MACHINE" -key "SOFTWARE\Micro ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,getRegistryValues

Steps to Reproduce

> Enable JEA
> Run discovery to Windows Server that has MSSql installed
> Check discovery log for step: Port from last connection.


update the MID Server Script file WinRMQueryOperations.psm1, and changed below line:
$valueNames = ($registryKey | Select-Object Property).Property;
$valueNames = ($registryKey | Microsoft.PowerShell.Utility\Select-Object Property).Property;

Related Problem: PRB1452975