win_shell
Execute a Windows shell command
Collection: ansible.windows
Full Name: parallax.windows.win_shell
Aliases: ansible.windows.win_shell, win_shell
Synopsis
Execute a Windows shell command
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| cmd | string | yes | Command line to execute; accepts free-form syntax | |
| chdir | string | Working directory for the command | ||
| creates | string | Skip when this path or wildcard pattern exists | ||
| removes | string | Skip when this path or wildcard pattern does not exist | ||
| stdin | string | Text to write to the command standard input | ||
| output_encoding_override | string | Override the UTF-8 output encoding with a named character encoding | ||
| executable | string | Shell executable; defaults to Windows PowerShell | ||
| no_profile | bool | false | Disable PowerShell profile loading |
Example
yaml
- name: Read the operating-system caption
ansible.windows.win_shell:
cmd: (Get-CimInstance Win32_OperatingSystem).Caption