Issue #22258 has been updated by Eric Badger. Status changed from Accepted to In Topic Branch Pending Review Branch set to https://github.com/puppetlabs/puppet/pull/1861
The above is a reasonable and safe way to solve this problem as far as I've been able to determine, so I'll go ahead and put it in a PR. ---------------------------------------- Bug #22258: Powershell execs failing when Puppet running as service https://projects.puppetlabs.com/issues/22258#change-96914 * Author: Eric Badger * Status: In Topic Branch Pending Review * Priority: Normal * Assignee: * Category: * Target version: * Affected Puppet version: 3.2.3 * Keywords: windows powershell * Branch: https://github.com/puppetlabs/puppet/pull/1861 ---------------------------------------- I've just started noticing this on a bunch of machines upgraded to 3.2.3 from 2.7.x, and double checked it on another machine (in a completely separate environment) that I upgraded from 3.2.1 (no issue in 3.2.1) to 3.2.4. 'exec' resources (both manually and with the powershell provider) that invoke powershell are failing when run by the puppet service. Error messages like so are appearing in event logs: (Here is one pair of events, from Server 2008 R2 upgraded from 3.2.1 to 3.2.4): <pre> /Stage[main]/Wintest/Exec[C:\windows\system32\windowspowershell\v1.0\powershell.exe -ExecutionPolicy Bypass -File C:\guy.ps1]/returns: change from notrun to 0 failed: C:\windows\system32\windowspowershell\v1.0\powershell.exe -ExecutionPolicy Bypass -File C:\guy.ps1 returned 5 instead of one of [0] </pre> <pre> C:\windows\system32\windowspowershell\v1.0\powershell.exe -ExecutionPolicy Bypass -File C:\guy.ps1 returned 5 instead of one of [0] </pre> (Here is another pair of events, from Win 7 upgraded from 2.7.x to 3.2.3): <pre> /Stage[main]/Softwarestat/Exec[C:\Windows\sysnative\WindowsPowershell\v1.0\powershell.exe -ExecutionPolicy Bypass -File C:\ProgramData\SoftwareStat\init.ps1 -Action Start -AlwaysCreate]/returns: change from notrun to 0 failed: C:\Windows\sysnative\WindowsPowershell\v1.0\powershell.exe -ExecutionPolicy Bypass -File C:\ProgramData\SoftwareStat\init.ps1 -Action Start -AlwaysCreate returned 2 instead of one of [0] </pre> <pre> /Stage[main]/Softwarestat/Exec[C:\Windows\sysnative\WindowsPowershell\v1.0\powershell.exe -ExecutionPolicy Bypass -File C:\ProgramData\SoftwareStat\init.ps1 -Action Start -AlwaysCreate]/returns: change from notrun to 0 failed: C:\Windows\sysnative\WindowsPowershell\v1.0\powershell.exe -ExecutionPolicy Bypass -File C:\ProgramData\SoftwareStat\init.ps1 -Action Start -AlwaysCreate returned 2 instead of one of [0] </pre> Additionally, on the second group of machines, events like these precede the Puppet events (Windows Error Reporting, id 1001): <pre> Fault bucket , type 0 Event Name: PowerShell Response: Not available Cab Id: 0 Problem signature: P1: powershell.exe P2: 6.1.7601.17514 P3: System.ComponentModel.Win32Exception P4: System.Management.Automation.Host.Host P5: erShell.ConsoleControl.GetActiveScreenBufferHandle P6: erShell.ConsoleControl.GetActiveScreenBufferHandle P7: Consol.. main thread P8: P9: P10: Attached files: These files may be available here: Analysis symbol: Rechecking for solution: 0 Report Id: 5bdfbad4-0aa4-11e3-8594-001ec935c471 Report Status: 0 </pre> <pre> Fault bucket 1734820220, type 5 Event Name: PowerShell Response: Not available Cab Id: 0 Problem signature: P1: powershell.exe P2: 6.1.7601.17514 P3: System.ComponentModel.Win32Exception P4: System.Management.Automation.Host.Host P5: erShell.ConsoleControl.GetActiveScreenBufferHandle P6: erShell.ConsoleControl.GetActiveScreenBufferHandle P7: Consol.. main thread P8: P9: P10: Attached files: These files may be available here: C:\ProgramData\Microsoft\Windows\WER\ReportArchive\Critical_powershell.exe_4acfe2abd478144236e324a622ef1611d17517_0336da42 Analysis symbol: Rechecking for solution: 0 Report Id: 398b9517-0a97-11e3-8594-001ec935c471 Report Status: 0 </pre> No issue occurs if I kick off puppet manually with 'puppet agent -t'. I also tried kicking off puppet with a scheduled task running as the SYSTEM user (executing the command 'puppet agent -t' or 'puppet agent --onetime'), which also worked fine. The issue seems to appear only when the service is starting the puppet run. -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/puppet-bugs. For more options, visit https://groups.google.com/groups/opt_out.
