Hi everyone,
Wazuh manager version:v3.6.1
Wazuh windows client version: v3.4.0
I'm having a problem with Windows powershell agent - server registration script available on wazuh 3.x documentation.
When I run the script the agent and key are correctly created on wazuh manager, but when I try to retrive thiese informations throuth API, the powershell script on client host return following error:
------------------------------------------------------------------------------
Adding agent:
Agent 'XXXXXXXXXXXX' with ID '@{id=014; key=MDE0IFdJTjEwQUdFTlQgMTcyLjE3LjIwLjI0NSA4YzRmMmIxZGZmNThlNmIyZDFiNzkyNzFjYmU0NmFhNDY5NDNjMTU0OGJiZjU5ZGQ1YTA0YjYyOTRkZTdjNGFi}' added.
Getting agent key:
ConvertFrom-Json : Invalid JSON primitive: System.Net.WebException.
At C:\Program Files (x86)\ossec-agent\register-agent.ps1:89 char:70
+ ... -method "GET" -resource "/agents/$($agent_id)/key" | ConvertFrom-Json
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [ConvertFrom-Json], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand
----------------------------------------------------------------------------------------
It seems as if the API return the requested information in a wrong format and the script can't pharse the JSON.
How can I resolve this problem?
Many thanks
Marco