Skip to content

Commit 1502783

Browse files
committed
(MODULES-6927) Fix Pipe Server on Win 2008r2
The newest image for Windows 2008r2 is exhibiting different behavior for loading .NET assemblies than we have seen in the past. The System.Core assembly is not loaded into the PowerShell host process by default any longer. This causes the init.ps1 script in the module to to fail to start a Pipe Server to receive PowerShell scripts to be executed. This change always attempts to load the System.Core assembly prior to creating the pipe server object. Explicity loading the assembly fixes the issue and the newest image becomes usable again. This fix is also required to fix any modules that depend on the PowerShell exec provider working properly.
1 parent d534477 commit 1502783

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/puppet_x/templates/powershell/init_ps.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ function Start-PipeServer
748748
$Encoding
749749
)
750750

751+
Add-Type -AssemblyName System.Core
752+
751753
# this does not require versioning in the payload as client / server are tightly coupled
752754
$server = New-Object System.IO.Pipes.NamedPipeServerStream($CommandChannelPipeName,
753755
[System.IO.Pipes.PipeDirection]::InOut)

0 commit comments

Comments
 (0)