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

cmdmod.exec_all doesn't work with Windows PowerShell #34199

Closed
lukasraska opened this issue Jun 22, 2016 · 1 comment
Closed

cmdmod.exec_all doesn't work with Windows PowerShell #34199

lukasraska opened this issue Jun 22, 2016 · 1 comment
Labels
Bug broken, incorrect, or confusing behavior Execution-Module fixed-pls-verify fix is linked, bug author to confirm fix P4 Priority 4 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around Windows
Milestone

Comments

@lukasraska
Copy link
Contributor

Description of Issue/Question

Execution of PowerShell scripts via cmdmod.exec_all is not possible as PowerShell requires:

  1. Command to have first argument '-File'
  2. Script to end with '.ps1' extension

There is possibility to use cmdmod.powershell, but it fails on some installations due to strong dependency on ConvertTo-Json

Setup

Windows minion with PowerShell

Steps to Reproduce Issue

Requires #34196 to be fixed to reproduce this issue at first place.

When executed without '-File':
Temp file opening is triggered on minion.

Execute salt 'windows-minion' cmd.exec_code_all powershell 'write-host "test string"'

When executed with '-File':

[root@master ~]# salt 'windows-minion' cmd.exec_code_all powershell 'write-host "test string"'
windows-minion:
    ----------
    pid:
        3676
    retcode:
        -196608
    stderr:
        Processing -File 'c:\users\admini~1\appdata\local\temp\2\tmphnatg2' failed because the file does not have a '.ps1' extension. Specify a valid PowerShell script file name, and then try again.
    stdout:

Versions Report

Salt Minion: 2016.3.0

PS C:\Users\Administrator> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
2      0      -1     -1
@Ch3LL
Copy link
Contributor

Ch3LL commented Jun 22, 2016

@DarkKnightCZ once again thanks so much for the fix to the issue! We will close this issue when its merged 👍

@Ch3LL Ch3LL added Bug broken, incorrect, or confusing behavior Execution-Module Windows Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around P4 Priority 4 labels Jun 22, 2016
@Ch3LL Ch3LL added this to the Approved milestone Jun 22, 2016
@rallytime rallytime added the fixed-pls-verify fix is linked, bug author to confirm fix label Jun 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Execution-Module fixed-pls-verify fix is linked, bug author to confirm fix P4 Priority 4 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around Windows
Projects
None yet
Development

No branches or pull requests

4 participants