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

pwsh - output not returned to puppet if Automatic Transcription is enabled #424

Open
scosens opened this issue Oct 25, 2024 · 0 comments
Open

Comments

@scosens
Copy link

scosens commented Oct 25, 2024

Describe the Bug

on windows nodes, when Automatic transcription is switched on for Powershell Core (HKLM\SOFTWARE\Policies\Microsoft\PowerShellCore\Transcription\EnableTranscripting), puppet no longer gets the output from an exec using the pwsh provider

Expected Behavior

when puppet executes an Exec resource using the pwsh provider and with logoutput => true, any output produced by the powershell commands should be returned to puppet and displayed either in the console or in event viewer.

Steps to Reproduce

Steps to reproduce the behavior:
on a windows node:

  1. ensure registry key HKLM\SOFTWARE\Policies\Microsoft\PowerShellCore\Transcription\EnableTranscripting either does not exist or = 0
  2. extract attached example module .zip to C:\ProgramData\PuppetLabs\code\environments\production\modules
  3. in a terminal window, run:

    puppet apply -e "include example" --test

  4. console output will contain the message 'this uses the pwsh provider', along with 'executed successfully'
  5. set registry key HKLM\SOFTWARE\Policies\Microsoft\PowerShellCore\Transcription\EnableTranscripting = 1
  6. repeat terminal command:

    puppet apply -e "include example" --test

  7. console output will no longer contain the message 'this uses the pwsh provider'. 'executed successfully' still appears.

Environment

replicated against:

  • puppet agent version 5.5.16,
  • powershell module 3.0.1 & 6.0.0
  • windows server 2019

Additional Context

example.zip

Using exec provider 'powershell' successfully returns the script output, even with automatic transcription enabled. Automatic transcription for standard Windows Powershell is enabled through a Group Policy item, however Powershell Core does not obey this setting, instead requiring it to be enabled in the registry as above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant