Checkmk agent registration fails when executed remotely

CMK version:2.1.0
OS Version: Appliance 1.5.1

i’m trying to automate the process of registering our updated windows hosts to thee monitoring for tls encryption. when i executing the command remotely via powershell i’m getting the error:

[2022-06-01 12:14:30.888993 +02:00] ERROR [cmk_agent_ctl] src\main.rs:29: Error loading client certificate
    + CategoryInfo          : NotSpecified: ([2022-06-01 12:...ent certificate:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

when executing the same script locally on the server it’s working fine.

my script:

$computerName = 'HOSTNAME'

Enter-PSSession -ComputerName $computerName 
   
    $hostname = $(($env:Computername).ToUpper())
    $user = "agent-registration"
    $secret = "XXXXX"
    $server = "192.168.21.251"
    $site = "lg"

    $arguments = "register", "--trust-cert", "-H$hostname", "-s$server", "-i$site", "-U$user", "-P$secret"
    & "C:\Program Files (x86)\checkmk\service\cmk-agent-ctl.exe" $arguments

has anybody encountered a similar problem, or an easier idea on how to automate this task?

Greetings
Moritz