PARALLAX

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

NameTypeRequiredDefaultDescription
cmdstringyesCommand line to execute; accepts free-form syntax
chdirstringWorking directory for the command
createsstringSkip when this path or wildcard pattern exists
removesstringSkip when this path or wildcard pattern does not exist
stdinstringText to write to the command standard input
output_encoding_overridestringOverride the UTF-8 output encoding with a named character encoding
executablestringShell executable; defaults to Windows PowerShell
no_profileboolfalseDisable PowerShell profile loading

Example

yaml
- name: Read the operating-system caption
  ansible.windows.win_shell:
    cmd: (Get-CimInstance Win32_OperatingSystem).Caption
Search
    ↑ ↓ move↵ openesc close