Skip to content

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

@scosens

Description

@scosens

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions