BizTalk 2016 CU5 gotcha: upgrade WinSCP to v5.13.1

With the release of BizTalk Server 2016 CU5, there is an important upgrade of WinSCP as mentioned in the release notes of  KB4087345:

BizTalk Server SFTP adapter is updated to use WinSCP version 5.13.1.

This means you will want to upgrade WinSCP to version 5.13.1 on all of your BizTalk servers if you are using SFTP that is, or are planning to use it at some point.

To do so, you must update the DLLs installed in your BizTalk Server installation directory (default C:\Program Files (x86)\Microsoft BizTalk Server 2016\).

Michael Stephenson originally posted a wonderful PowerShell script to install WinSCP automatically to the BizTalk folder. Some time after that, Thomas Canter updated and improved the script.

Now, for CU5 I made another change to include the correct version.

You can find the adapter script (originally from Thomas Canter) here, I only updated references to the correct version for BizTalk 2016 CU5:


Param([Parameter(Mandatory=$true)][string]$downloadNoGetTo)
$Continue = $true
$downloadNoGetToExists = Test-Path $downloadNoGetTo
if (-not $downloadNoGetToExists)
{
New-Item Path $downloadNoGetTo ItemType "Directory"
}
if (-not $downloadNoGetToExists)
{
$Continue = $false
Write-Host "An attempt to use the " $downloadNoGetTo " directory for a download target failed"
}
if ($Continue)
{
$bizTalkInstallFolder = (Get-Item Env:BTSINSTALLPATH).Value
if (-not $bizTalkInstallFolder)
{
$bizTalkInstallFolder = (get-itemPropertyValue 'HKLM:\SOFTWARE\Microsoft\BizTalk Server\3.0' Name 'InstallPath')
if (-not $bizTalkInstallFolder)
{
$bizTalkInstallFolder = "C:\Program Files (x86)\Microsoft BizTalk Server 2016\\"
}
}
$bizTalkInstallFolderExists = Test-Path $bizTalkInstallFolder
if (-not $bizTalkInstallFolderExists)
{
$Continue = $false
Write-Host "The BizTalk Installation was not found by inspecting the enviornment or registry."
}
if ($Continue)
{
#Download NuGet
$sourceNugetExe = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
Write-Host Downloading Nuget from $sourceNugetExe
$targetNugetExe = "$downloadNoGetTo\nuget.exe"
Invoke-WebRequest $sourceNugetExe OutFile $targetNugetExe
$targetNugetExeExists = Test-Path $targetNugetExe
if (-not $targetNugetExeExists)
{
$Continue = $false
Write-Host "The download of the Nuget EXE from " $sourceNugetExe " did not succeed"
}
if ($Continue)
{
#Download the right version of WinSCP
Write-Host "Downloading WinSCP from NuGet " + $sourceNugetExe
Invoke-Expression "$targetNugetExe Install WinSCP -Version 5.13.1 -OutputDirectory $downloadNoGetTo"
$WinSCP = "$downloadNoGetTo\WinSCP.5.13.1\tools\WinSCP.exe"
$WinSCPDll = "$downloadNoGetTo\WinSCP.5.13.1\lib\net\WinSCPnet.dll"
$WinSCPExists = Test-Path $WinSCP
$WinSCPDLLExists = Test-Path $WinSCPDll
if (-not $WinSCPExists -or -not $WinSCPDLLExists)
{
$Continue = $false
Write-Host "WinSCP 5.13.1 was not properly downloaded"
}
if ($Continue)
{
#Copy WinSCP items to BizTalk Folder
Write-Host "Copying WinSCP Nuget to BizTalk Folder"
Copy-Item $WinSCP $bizTalkInstallFolder
Copy-Item $WinSCPDll $bizTalkInstallFolder
$WinSCPBTSExists = Test-Path "$bizTalkInstallFolder\WinSCP.exe"
$WinSCPDLLBTSExists = Test-Path "$biztalkInstallFolder\WinSCPnet.dll"
if (-not $WinSCPBTSExists)
{
$Continue = $false
Write-Host "The WinSCP.exe file was not properly copied to the target folder " $bizTalkInstallFolder
}
if (-not $WinSCPDLLBTSExists)
{
$Continue = $false
Write-Host "The WinSCPnet.exe file was not properly copied to the target folder " $bizTalkInstallFolder
}
}
}
}
}
if (-not $Continue)
{
Write-Host "Something went wrong during installation and the installation is not working"
Write-Host "Please inspect the errors above and resolve them"
}
else
{
Write-Host "WinSCP has been properly installed for BizTalk's SFTP Adapter"
}

 

 

1 thought on “BizTalk 2016 CU5 gotcha: upgrade WinSCP to v5.13.1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s