RPC shutdown question

hi,

here my configuration.yaml
switch:

  • platform: wake_on_lan
    mac: “xx:xx:xx:xx:xx”
    name: Wake on lan
    host: “192.168.xxx.xxx”
    turn_off:
    service: shell_command.turn_off_pc
    shell_command:
    turn_off_pc: ‘net rpc shutdown -I 192.168.xxx.xxx -U user%pass’

the wake up works fine, the shutdown does not work.
If i manually launch “net rpc shutdown -I 192.168.xxx.xxx -U user%pass” on the raspberry it wrks fine, why via HA does not shutdown?
thanks

Please paste your code as preformatted text (</> in the tolbar).

switch:
  - platform: wake_on_lan
    mac: "xxx"
    name: Wake on lan
    host: "xxx"
    turn_off:
      service: shell_command.turn_off_pc
shell_command:
  turn_off_pc: 'net rpc shutdown -I xx -U xx%xx'

if i replace net rpc bla bla with touch test.txt it works

This script has been working for me:

dell_shut_down:
  alias: Shut down Dell
  sequence:
  - data:
      addon: core_rpc_shutdown
      input: dell1
    service: hassio.addon_stdin
  mode: single

…and in the add-on configuration:

- alias: dell1
  address: xxx.xx.x.xxx
  credentials: HomeAssistant%B77cFB959o
  delay: 0
  message: >-
    Home Assistant is shutting down this PC. This cannot be cancelled. Please
    save your work!

i’m debugging but…

  - platform: wake_on_lan
    mac: "xxxx"
    name: Wake on lan
    host: "xxx"
    turn_off:
      service: shell_command.turn_off_pc
shell_command:
  turn_off_pc: bash ./shut.sh

root@raspberrypi:/home/homeassistant/.homeassistant# ls output*
output output2 output3
root@raspberrypi:/home/homeassistant/.homeassistant# cat output
./shut.sh: line 1: ./net: No such file or directory
root@raspberrypi:/home/homeassistant/.homeassistant# cat output2
./shut.sh: line 2: /usr/bin/net: No such file or directory
root@raspberrypi:/home/homeassistant/.homeassistant# ls net
net
root@raspberrypi:/home/homeassistant/.homeassistant#

if i launch shut.sh outside HA, it works…

ok i figured to work with

switch:
  - platform: wake_on_lan
    mac: "xxx"
    name: Wake on lan
    host: "xxx"
    turn_off:
      service: shell_command.turn_off_pc
shell_command:
  turn_off_pc: ssh -i .ssh/id_rsa -o 'StrictHostKeyChecking=no' root@localhost "net rpc shutdown -I xxx -U xxx%xxx"