Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new session parameter to win_psexec #44263

Merged
merged 3 commits into from
Aug 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/win_psexec_session-selection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- win_psexec - Added the ``session`` option to specify a session to start the process in
4 changes: 4 additions & 0 deletions lib/ansible/modules/windows/win_psexec.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ $elevated = Get-AnsibleParam -obj $params -name "elevated" -type "bool" -default
$limited = Get-AnsibleParam -obj $params -name "limited" -type "bool" -default $false
$system = Get-AnsibleParam -obj $params -name "system" -type "bool" -default $false
$interactive = Get-AnsibleParam -obj $params -name "interactive" -type "bool" -default $false
$session = Get-AnsibleParam -obj $params -name "session" -type "int"
$priority = Get-AnsibleParam -obj $params -name "priority" -type "str" -validateset "background","low","belownormal","abovenormal","high","realtime"
$timeout = Get-AnsibleParam -obj $params -name "timeout" -type "int"
$extra_opts = Get-AnsibleParam -obj $params -name "extra_opts" -type "list"
Expand Down Expand Up @@ -83,6 +84,9 @@ If ($system -eq $true) {

If ($interactive -eq $true) {
$arguments += "-i"
If ($session -ne $null) {
$arguments += $session
}
}

If ($limited -eq $true) {
Expand Down
7 changes: 7 additions & 0 deletions lib/ansible/modules/windows/win_psexec.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@
- Run the program so that it interacts with the desktop on the remote system.
type: bool
default: 'no'
session:
description:
- Specifies the session ID to use.
- This parameter works in conjunction with I(interactive).
- It has no effect when I(interactive) is set to C(no).
type: int
version_added: '2.7'
limited:
description:
- Run the command as limited user (strips the Administrators group and allows only privileges assigned to the Users group).
Expand Down