Hi The win_shell module actually executes a command in the PowerShell where dir is an alias for Get-ChildItem. Get-ChildItem (and other PS cmdlets) do not have parameters or switches in the form of /* which is why you are getting this error. You can either change your task to use the PowerShell cmdlet format or change the shell to cmd. You can also use win_find if you want to have more advanced filters or search recursively so have a look at that if you want to filter on the files.
- name: using native PS cmdlet win_shell: Get-ChildItem -Path C:\Temp | ForEach-Object { $_.Name } - name: change shell to cmd win_shell: dir /b c:\temp args: executable: cmd Here is the output of both of those tasks <https://lh3.googleusercontent.com/-kmie9HG5SXk/Wd6GOD6cjnI/AAAAAAAAAQg/n_FT9OolfJQLpt_elaJmoPbHT7vyq1q4gCLcBGAs/s1600/Screen%2BShot%2B2017-10-12%2Bat%2B6.59.03%2Bam.png> In your case I would go with the cmd option as it is faster (5s as opening Powershell takes time) and less verbose but the PS option is good if you need to save variables or do something with the data before sending it back to Ansible. Thanks Jordan -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/b9fafb12-82f5-40db-b9d7-7a81ceb230a5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.