API: Quemu Guest Agent Windows No args

AdminSecNum

New Member
Feb 2, 2024
2
0
1
Hello, I have come to you regarding a problem when running pvesh on a Qemu Guest Windows agent.

I try to send a command for example netsh help

if I only send the netsh command, I get the PID back

Code:
pvesh create /nodes/XXXX/qemu/200/agent/exec --command 'netsh'

If I put an argument to the command it is no longer executed

Code:
pvesh create /nodes/XXXX/qemu/200/agent/exec --command 'netsh help'
Agent error: Guest agent command failed, error was 'Failed to execute child process (No such file or directory)'

in the qemu agent log I can see that the command is only in the path and that the arguments are empty :

Code:
1706861085.367996: debug: read data, count: 153, data: {"arguments":{"id":33244502},"execute":"guest-sync-delimited"}
{"arguments":{"path":"netsh help","capture-output":true,"arg":[]},"execute":"guest-exec"}

Code:
qm guest exec 200 -- 'netsh' 'help'

When I execute the command with qm it works, and I have the arguments visible in the logs

Code:
1706861225.320535: debug: read data, count: 154, data: {"execute":"guest-sync-delimited","arguments":{"id":33280402}}
{"arguments":{"arg":["help"],"path":"netsh","capture-output":true},"execute":"guest-exec"}

Any advice ?