# playbook problem

**URL:** <https://forum.ansible.com/t/playbook-problem/31202>\
**Category:** Ansible Project\
**Tags:** awx\
**Created:** [September 5, 2019, 4:09am UTC](https://forum.ansible.com/t/playbook-problem/31202 "2019-09-05T04:09:04Z")\
**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:** [September 5, 2019, 4:09am UTC](https://forum.ansible.com/t/playbook-problem/31202/1 "2019-09-05T04:09:04Z")

</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://groups.google.com/group/awx-project/attach/14c89916be3fa/2019-08-23_151009.png?part=0.1&view=1&authuser=0)
