Skip to content

Windows Server Windows Server: Commands

Summary

This module contains actions for running Powershell & DOS commands on a Windows Server.

Actions

windows_server.commands.

run_dos

Run a DOS command.

Input
  • windows_server: a WindowsServer

  • command: the DOS command to run

  • environment: optional dictionary with environment variables to set when running the script

Output

The command output as a string.

Example
1
2
3
4
5
- windows_server.commands.run_dos:
    command: ver
  load:
    windows_server: windows_server
  save: version

windows_server.commands.

run_powershell

Run a Powershell script.

Supports single commands & multi-line scripts.

Input
  • windows_server: a WindowsServer

  • script: the Powershell script to run

  • configuration_name: optional PowerShell configuration endpoint to use when uploading the file

  • environment: optional dictionary with environment variables to set when running the script

Output

The script output as a string.

Example
1
2
3
4
- windows_server.commands.run_powershell:
    script: Restart-Service -name spooler
  load:
    windows_server: windows_server