# Use ansible adhoc command with vmware

**URL:** <https://forum.ansible.com/t/use-ansible-adhoc-command-with-vmware/38232>\
**Category:** Ansible Project\
**Tags:** vmware\
**Created:** [July 16, 2023, 2:52pm UTC](https://forum.ansible.com/t/use-ansible-adhoc-command-with-vmware/38232 "2023-07-16T14:52:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wael\_ElMasry](https://avatars.discourse-cdn.com/v4/letter/w/bc8723/32.png) [@Wael\_ElMasry](https://forum.ansible.com/u/Wael_ElMasry)\
**Post date:** [July 16, 2023, 2:52pm UTC](https://forum.ansible.com/t/use-ansible-adhoc-command-with-vmware/38232/1 "2023-07-16T14:52:51Z")

</div>

I am new to Ansible, is it possible to use the adhoc command with ansible module (vmware.vmware\_rest.\*) ?

I am trying to run a simple comma to get virtual machine info.

ansible -m vmware.vmware\_rest.vcenter\_vm\_info -a “vcenter\_hostname=vcenter-ip vcenter\_username=username vcenter\_password=password”

Looks like this is failing because its missing the the pattern/hosts.

Also, using the ipaddress/hostname for the vcenter does not work.

ansible vcenter-ip -m vmware.vmware\_rest.vcenter\_vm\_info -a “vcenter\_hostname=vcenter-ip vcenter\_username=username vcenter\_password=password”

and that vcenter ip is already in the inventory file.

Please help

---

<div class="post-metadata">

**Author:** ![Akasurde](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/akasurde/32/230_2.png) [@Akasurde](https://forum.ansible.com/u/Akasurde)\
**Post date:** [July 17, 2023, 2:07pm UTC](https://forum.ansible.com/t/use-ansible-adhoc-command-with-vmware/38232/2 "2023-07-17T14:07:41Z")

</div>

What is the error you get when you run ad-hoc command?
