+
Skip to content

WinSCP Version is newer than Module #160

@rik-e

Description

@rik-e

Issue Description

Write-Error: Exception calling "Open" with "1" argument(s): "The version of C:\Program Files (x86)\WinSCP\winscp.exe (6.
3.3.0) does not match version of this assembly C:\Program Files\WindowsPowerShell\Modules\WinSCP\6.3.2.0\lib\net40\WinSC
Pnet.dll (6.3.2.0)." (NotSpecified: (:) [Write-Error], WriteErrorException)
Exception calling "Open" with "1" argument(s): "The version of C:\Program Files (x86)\WinSCP\winscp.exe (6.3.3.0) does n
ot match version of this assembly C:\Program Files\WindowsPowerShell\Modules\WinSCP\6.3.2.0\lib\net40\WinSCPnet.dll (6.3
.2.0)."

Example

$Session = New-Object WinSCP.Session
$SessionOptions = New-Object WinSCP.SessionOptions
$SessionOptions.Protocol = [WinSCP.Protocol]::Sftp
$SessionOptions.HostName = $SFTPSite
$SessionOptions.UserName = $SFTPUser
[Password and KEYS] 

try {
    # Herstellen der Verbindung zum SFTP Server
    $session.Open($sessionOptions)
 
    # Hinterlegen der Session in allen CMDlets
    Get-Command -Module WinSCP -ParameterName WinSCPSession | ForEach-Object {
        $Global:PSDefaultParameterValues.Remove("$($_.Name):WinSCPSession")
        $Global:PSDefaultParameterValues.Add("$($_.Name):WinSCPSession", $session)
    }
 
} catch {
    Write-Error $_
    $session.Dispose()
    exit(1)
}

Expected Output

Connection is established. Newer Version of the module is missing.

Actual Output

See Issue description

WinSCP-PowerShell Version

ModuleType Version    Name                                ExportedCommands                                             
---------- -------    ----                                ----------------                                             
Script     6.3.2.0    winscp                              {ConvertTo-WinSCPEscapedString, Copy-WinSCPItem, Get-WinSC...

Environment

Windows Server 2019 Datacenter

Name : ConsoleHost
Version : 5.1.17763.5696
InstanceId : c99acbd0-8249-4011-8a17-d5c96ab0a5ad
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : de-DE
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载