Powershell: Exception on New-Object WinSCP.Session

Advertisement

tmontana3x
Guest

Powershell: Exception on New-Object WinSCP.Session

Hello,
i hope you may help. I have Powershell 6 and when i try to New-Object WinSCP.Session i get the following error:

new-object : Exception calling ".ctor" with "0" argument(s): "Could not load type 'System.Diagnostics.PerformanceCounter' from assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'."
At line:1 char:1
+ new-object winscp.session
+
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationEx
ception
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.
Commands.NewObjectCommand

I hope you can help me.

Thank you

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,442
Location:
Prague, Czechia

Re: Powershell: Exception on New-Object WinSCP.Session

I'm not yet familiar with PowerShell Core 6, but note that WinSCP .NET assembly needs a full .NET Framework, not just .NET Core. So that can be the problem.

Reply with quote

tmontana3x
Guest

Re: Powershell: Exception on New-Object WinSCP.Session

martin wrote:

I'm not yet familiar with PowerShell Core 6, but note that WinSCP .NET assembly needs a full .NET Framework, not just .NET Core. So that can be the problem.

Hello, thanks for the info, so i can just install .net framework (version?) and everything fine? Or does PS6 only accept .net core?

Best!

Reply with quote

Guest

Re: Powershell: Exception on New-Object WinSCP.Session

tmontana3x wrote:

martin wrote:

I'm not yet familiar with PowerShell Core 6, but note that WinSCP .NET assembly needs a full .NET Framework, not just .NET Core. So that can be the problem.

Best!

Hello again, Dot Net Framework 4.7.1 is already installed... any other ideas?

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: Solved

tmontana3x wrote:

as i found out ps 5.1. is also available on the system - with that its working
So before, did you try to use WinSCP from pwsh.exe?

Reply with quote

Advertisement

You can post new topics in this forum