I have two different versions of powershell on my machine.
With powershell.exe I can execute
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$oReturn=[System.Windows.Forms.Messagebox]::Show("This is the Message text")
But with pwsh.exe I get the error
Exception calling "LoadWithPartialName" with "1" argument(s): "Could not load file or assembly 'System.Windows.Forms, Culture=neutral, PublicKeyToken=null'. Operation is not supported. (Exception from HRESULT: 0x80131515)"
At line:1 char:2
+ [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Fo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : FileLoadException
What's up here? Every time I opened powershell over the last 6 months I was shell spammed and told to upgrade to powershell 6. Now I have and the above doesn't work.
User contributions licensed under CC BY-SA 3.0