puppetlabs / puppetlabs/puppetlabs-powershell
pwsh - output not returned to puppet if Automatic Transcription is enabled
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 47
- Forks
- 80
- Avg merge
- 52m
- Merged PRs (30d)
- 1
Description
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:
- ensure registry key HKLM\SOFTWARE\Policies\Microsoft\PowerShellCore\Transcription\EnableTranscripting either does not exist or = 0
- extract attached example module .zip to C:\ProgramData\PuppetLabs\code\environments\production\modules
- in a terminal window, run:
puppet apply -e "include example" --test
- console output will contain the message 'this uses the pwsh provider', along with 'executed successfully'
- set registry key HKLM\SOFTWARE\Policies\Microsoft\PowerShellCore\Transcription\EnableTranscripting = 1
- repeat terminal command:
puppet apply -e "include example" --test
- 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
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the pwsh provider and an Exec resource using puppet apply on Windows, first with transcription disabled and then with EnableTranscripting set to 1. Trace how command output is returned when logoutput => true, and confirm that the output appears in the console or event viewer in both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100