What command can be used to add a remote server to the TrustedHosts list?

We are getting the following WinRM error despite adding this IP address in the TrustedHosts. What could be the reason?
WMI query on host 10.x.x.y authentication failure. query: Select * From Win32_Process WHERE (ProcessId = 324708) error: Winrs error:The WinRM client cannot process the request. Default authentication may be used with an IP address under the following conditions: the transport is HTTPS or the destination is in the TrustedHosts list, and explicit credentials are provided. Use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. For more information on how to set TrustedHosts run the following command: winrm help config.. Access is Denied

Here's the detail from ecc logs;

08/16/20 08:54:12 (184) Worker-Interactive:ADMEPowershell-4e4d102f1b2a9010f45443b3cd4bcb59 WARNING *** WARNING *** Fatal Exception :
New-PSSession : [10.x.x.y] Connecting to remote server 10.x.x.y failed with the following error message :
The WinRM client cannot process the request. Default authentication may be used with an IP address under the following conditions:
the transport is HTTPS or the destination is in the TrustedHosts list, and explicit credentials are provided.
Use winrm.cmd to configure TrustedHosts.
Note that computers in the TrustedHosts list might not be authenticated.
For more information on how to set TrustedHosts run the following command: winrm help config.
For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ New-PSSession -ComputerName 10.x.x.y -Port 5985 -Credential $Creden ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : CannotUseIPAddress,PSSessionOpenFailed
Invoke-Command : Cannot validate argument on parameter 'Session'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At D:\MidServer-SBOX\agent\scripts\Powershell\ADMEnhanced\ADMELauncherWinRM.psm1:103 char:44
+ $firstTime = Invoke-Command -session $ps -scriptblock ${functio ...
+ ~~~
+ CategoryInfo : InvalidData: (:) [Invoke-Command], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.InvokeCommandCommand

Invoke-Command : Cannot validate argument on parameter 'Session'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At D:\MidServer-SBOX\agent\scripts\Powershell\ADMEnhanced\ADMELauncherWinRM.psm1:109 char:41
+ $result = Invoke-Command -session $ps -scriptblock ${function:l ...
+ ~~~
+ CategoryInfo : InvalidData: (:) [Invoke-Command], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.InvokeCommandCommand

Error launching process
At D:\MidServer-SBOX\agent\scripts\Powershell\ADMEnhanced\ADMELauncherWinRM.psm1:113 char:9
+ throw "Error launching process"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Error launching process:String) [], RuntimeException
+ FullyQualifiedErrorId : Error launching process

Some of the tools require an appropriate target host configuration before you can use them in the Parallels RAS Console. Please read the following requirements and make sure they are met.

To use Remote Desktop, remote connections must be enabled on a target host. You can verify that by using the standard Windows Remote Desktop Connection application and see if you can connect to a remote server.

PowerShell related tools require PowerShell remoting enabled on a target server. To enable PowerShell remoting, run the Enable-PSRemoting cmdlet on a target computer in PowerShell window with administrator privileges. Please note the following:

§  The cmdlet configures a computer to receive PowerShell remote commands.

§  The cmdlet starts the WinRM (Windows Remote Management) service, among other tasks. To see if the WinRM service is running, use the Test-WSMan cmdlet.

§  When you execute the cmdlet, it will ask you to confirm every task that it wants to perform. To execute the command silently, use the -Force option.

§  If you receive an error saying that "WinRM firewall exception will not work since one of the network connection types on this machine is set to Public", you can try to execute the cmdlet with the -SkipNetworkProfileCheck option, or you can change the network connection type on this host to Domain or Private.

To use PowerShell to manage a remote host, you also need to add the host to the TrustedHosts list on the computer where you have the RAS Console installed.

To view the current TrustedHosts list, execute the following command in PowerShell window: Get-Item WSMan:\localhost\Client\TrustedHosts

To add a host to the TrustedHosts list, use one of the options described below. Please note that all examples below, except the last one, always overwrite an existing TrustedHosts list. To add a specific computer to an existing list, use the last example (the one with the -Concatenate parameter).

  • Add all computers to the list: Set-Item WSMan:\localhost\Client\TrustedHosts *
  • Add all domain computers: Set-Item WSMan:\localhost\Client\TrustedHosts *.domain-name.dom
  • Add specific computers: Set-Item WSMan:\localhost\Client\TrustedHosts ,[]
  • Add a computer to an existing list (this is the only example that will NOT overwrite an existing TrustedHosts list): 

    What is trusted hosts?

    The trusted hosts definition file is a text file which lists all the hosts that have authority to access the client port of a Client Access Bridge server. The connection will be dropped if the host attempting to connect to client port is not listed in the trusted hosts definition file.

    How to use PowerShell remoting?

    PowerShell remoting is enabled by default on Windows Server platforms. You can use Enable-PSRemoting to enable PowerShell remoting on other supported versions of Windows and to re-enable remoting if it becomes disabled. You have to run this command only one time on each computer that will receive commands.