win_psexec: execute cmds on remote systems as any user (#20141)

* win_psexec: execute cmds on remote systems as any user

This module uses the versatile psexec tool to run any command remotely
as any user (incl. domain users).

* Add missing documentation

Now that this module is deemed acceptable for inclusion,
the documentation is an essential part.

* win_psexec: Small cosmetic changes

* win_psexec: add more options (priority, elevated, ...)

* Fixes after more testing

* Renamed 'cmd' to 'psexec_command' + more

- Also replaced PSObject() with a hash table
- Made $chdir of type "path"
- Renamed $args to $extra_args

* Various improvements

- Switched to using booleans for most parameters
- Added type 'bool' to boolean parameters
- Added 'interactive' parameter
- Added 'wait' parameter
- Added an interactive example

* Added -type "bool" support to Get-AnsibleParam

* Fix deadlock

* When using `wait:no` return code is PID of process
This commit is contained in:
Dag Wieers
2017-01-24 14:48:58 +01:00
committed by John R Barker
parent 5475f3ee64
commit 8296511ed0
3 changed files with 358 additions and 1 deletions

View File

@@ -157,9 +157,12 @@ Function Get-AnsibleParam($obj, $name, $default = $null, $resultobj, $failifempt
}
}
# Expand environment variables on path-type (Beware: turns $null into "")
If ($value -ne $null -and $type -eq "path") {
# Expand environment variables on path-type (Beware: turns $null into "")
$value = Expand-Environment($value)
} ElseIf ($type -eq "bool") {
# Convert boolean types to real Powershell booleans
$value = $value | ConvertTo-Bool
}
$value