Windows Management Framework 3.0 update breaks PSTerminalServices

Dec 19, 2012 at 1:45 AM

Hello,

It appears that the Windows Management Framework 3.0 for Windows 7 SP1 and Windows Server 2008 R2 SP1 update (http://support.microsoft.com/kb/2506143), which includes PowerShell 3.0, breaks PSTerminalServices.

When trying to 'Import-Module PSTerminalServices' I get the following error:

Import-Module : Could not load file or assembly 'file:///P:\Documents\WindowsPowerShell\Modules\PSTerminalServices\bin\cassia.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) At P:\Documents\Scripts\ScriptName.ps1:17 char:1
+Import-Module PSTerminalServices
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	+ CategoryInfo          : InvalidOperation: (:) [Import-Module], FileLoadException
	+ FullyQualifiedErrorId : FormatXMLUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand

Yes, the Cassia.dll file is at the location referenced in the error above, I quintuple checked. However, PowerShell doesn't seem to "see" it.

I should note that P: is a network share and I have mapped my My Documents (and other libraries) to that location. Running this exact script works fine in PowerShell 2.0.

Uninstalling the offending Windows Update allows the import to take place without an issue, so I'm assuming PowerShell 3.0 has broken this functionality somehow. However, I am able to import other custom modules from that same network location just fine with PS 3.0.

Anyone else having this problem with PSTerminalServices? Any idea on how to fix it?

Thanks!

Coordinator
Dec 19, 2012 at 8:06 AM

Please check if this helps solve the problem.

http://huddledmasses.org/how-to-import-binary-modules-from-network-shares/

Dec 19, 2012 at 9:58 PM

Hi Shay,

Thank you for the help. However, I've found that the solution detailed here http://stackoverflow.com/a/13572321/1368688 solves the problem.

This involves creating a text file at $PSHOME\powershell.exe.config with the following contents:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0"/>
        <supportedRuntime version="v2.0"/>
    </startup>
    <runtime>
        <loadFromRemoteSources enabled="true"/>
    </runtime>
</configuration>

Thanks. 

Coordinator
Dec 20, 2012 at 8:16 AM
Edited Dec 20, 2012 at 8:16 AM

Awesome, that was my next suggestion :)