Diffculty with registering the script output

I am trying to execute a shut down script and Shut down remote server upon successful execution of the script . I do not want to shutdown the server when the script fails.
I did write the play book below, but it is throwing errors. can some one help me on this?

- hosts: all
  user: test
  become: yes
  connection: ssh
  gather_facts: false
  ignore_errors: yes

  tasks:
     - name: execute stop.sh script
        shell: /home/test/stop.sh
        register: script_output
        
     - debug:
            var: script_output
    
    - name: shutdown the server
        command: shutdown -h now
        when: "script_output.rc !=0"

Remove the quotation marks. The conditionals are expanded automatically.

when: “scrtipt_output.rc !=0”

The error was: template error while templating string: unexpected char u"'" at 29

Alternatively you might want to use:

when: not scrtipt_output.failed

Thanks alot!
when: not scrtipt_output.failed

This is worked for me!!!