Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

Mister H

Confirmed, that was the issue. Setting that variable to "Legacy" allowed the PowerShell v7.3.1 Core script to work again. Thank you Martin!
martin

Re: Too many parameters for command 'open'. WinSCP V5.21.6 PowerShell Core 7.3.1 Issue

There's breaking change in PowerShell 7.3.0 that's likely the culprit.
Adding this before WinSCP invocation should fix it:
$PSNativeCommandArgumentPassing = 'Legacy'

For details, see:
PowerShell 7.3.0 breaking command invocation
Mister H

Too many parameters for command 'open'. WinSCP V5.21.6 PowerShell Core 7.3.1 Issue

Previously working PowerShell script recently broke. Interesting thing is it still works when running PowerShell 5 desktop and was previously working with PowerShell 7 v7.x.x core until recently. Tried updating to WinSCP v5.21.6 but it didn't help.
"C:\program files\powershell\7\pwsh.exe" -noprofile -windowstyle hidden -executionpolicy bypass -file C:\Users\**********************\Documents\CleverExport-Debug.ps1

Throws the error:
Too many parameters for command 'open'.

Yes, I've reviewed the other posts relating to this same error but couldn't find anything specific to why PS7 core would break all of the sudden. It could be related to a MSFT update but that's just a blind guess.