# playbook question

**URL:** <https://forum.ansible.com/t/playbook-question/31109>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [August 23, 2019, 7:11am UTC](https://forum.ansible.com/t/playbook-question/31109 "2019-08-23T07:11:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Luk](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@Matt\_Luk](https://forum.ansible.com/u/Matt_Luk)\
**Post date:** [August 23, 2019, 7:11am UTC](https://forum.ansible.com/t/playbook-question/31109/1 "2019-08-23T07:11:47Z")

</div>

I want use AWX to shut down the VM in hyper-V.

powershell query:

> **$a = Get-ClusterGroup | Where-Object {$_.Name -like “server1” -and $_.State -eq ‘Online’}**  
> **$b = $a.OwnerNode**  
> **Stop-VM -Name “vm1” -ComputerName $b**

may I know the playbook query is that?

> ```auto
> **- name: Hyper-V shutdown VM**
> 
> ```
> 
> ```auto
> **hosts: all**
> 
> ```
> 
> ```auto
> **gather_facts: no**
> 
> ```
> 
> ```auto
>  
> 
> ```
> 
> ```auto
> **tasks:**
> 
> ```
> 
> ```auto
> **- win_shell: |**
> 
> ```
> 
> ```auto
> **$a = Get-ClusterGroup | Where-Object {$_.Name -like "{{ vm }}" -and $_.State -eq 'Online'}**
> 
> ```
> 
> ```auto
> **$b = $a.OwnerNode**
> 
> ```
> 
> ```auto
> **Stop-VM -Name "{{ vm }}" -ComputerName $b**
> 
> ```

In job template extra variable:

 ![2019-08-23_151009.png](https://us1.discourse-cdn.com/ansible/original/2X/f/fabac053593f3549a05c89016744e1a1d57f7c8e.png)
