I defined a PowerShell script, tried to run it with the code and also as blank script. in both cases I get the following error:
The type initializer for 'System.Management.Automation.SessionStateScope' threw an exception.
On the web I found other people having the same issue and fixed the problem by removing
from the OWSTimer.EXE.Config
. In my case the element wasn't already there.