I am trying to run a script against SharePoint 2007 which works well on other systems, but one system keeps giving me an error:
PS C:\Windows\System32\WindowsPowerShell\v1.0> c:\scripts\emptylist.ps1
GAC Version Location
--- ------- --------
True v2.0.50727 C:\Windows\assembly\GAC_MSIL\Microsoft.SharePoint\12.0.0.0__71e9bce111e9429c\Microsoft.SharePoint.dll
new-object : Exception calling ".ctor" with "1" argument(s): "Exception of type 'System.PlatformNotSupportedException' was thrown."
At C:\scripts\emptylist.ps1:22 char:11
+ $spsite = new-object Microsoft.SharePoint.SPSite($web)
I have create a powershell.exe.config file with this configuration:
<?xml version="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0.30319"/>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
but I stiil get the error. How do I get this to work?