-
Notifications
You must be signed in to change notification settings - Fork 80
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.