-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[BUG] failed to execute powershell script using "cmd.script" with "runas" parameter #61166
Comments
I am having the same issue... happy to help fix the bug if I can! Is there anything I can do to help? |
@ovybach I have figured out the issue and submitted a PR for the maintainers consideration. As a workaround, you can edit the configuration file on your minions and set the |
Apparently, Salt changed the default rootdir with version 3004 to C:/ProgramData/Salt Project, which includes a whitespace and the Powershell calls later are not using the appropriate quotes. It's actually a really bad implementation. Not sure how this could pass the QA, it's also not mentioned in the documentation. And the support told us to wait for a fix in some future release. There is actually a much simpler solution: just use the MSI installer and pass the installdir and rootdir as parameters. The installer will take care of the rest and use the same directories that older versions were using (C:/salt). No manual editing of config files required. Here's a sample call from my install script, works perfectly fine with 3004.2: To the Salt devs: Please consider to make C:\salt the default again. It worked for years without any problems and there is no reason to force a move to ProgramData ;-) |
This is how I made it work on my 3004.2 minion. Unfortunately, haven't set up environment to test all possible scenarios.
|
This should be addressed by #66447 |
Description
Failed to execute powershell script using "cmd.script" with "runas" parameter. Step fails with error:
Setup
Issue is reproducible locally on salt-minion and through salt-master.
OS: Windows Server 2019
PowerShell version: 5.1.17763.2183
Salt: 3004
Steps to Reproduce the behavior
Execute the following sls file:
Note: user creation step is not mandatory if you already have some testing user to use for "runas".
Expected behavior
Step "run_script" should finish successfully with "Hello World" stdout message
Debug log: salt-debug-log.txt
Salt output: salt-output.txt
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Additional context
cmd.script works fine if you don't use "runas" parameter.
The text was updated successfully, but these errors were encountered: