How to Restart the SFTP BizTalk Server Host Instance with PowerShell (Version 2)

  • Sandro Pereira
  • Jul 8, 2025
  • 4 min read

Last blog post – How to Restart the SFTP BizTalk Server Host Instance with PowerShell – I had explained how you can restart the SFTP Host Instance with a simple PowerShell script using WMI. The main problem with that approach – well, maybe it’s not a problem, but personally I don’t like it – is that it requires two instructions: Start and Stop, with a delay in the middle, just to guarantee that the services have time to actually stop. However, this can be a point of failure, as the host instance may sometimes take a longer time to stop. So, I decided to publish a simple approach to addressing this task, one that I believe is more effective.

📝 One-Minute Brief

In this blog post, we explore how to resolve common issues with the BizTalk SFTP adapter — such as connection failures or unexpected behavior — by restarting the host instance that runs it. You’ll learn why these problems often occur, how restarting the host instance can quickly restore functionality, and the two main ways to automate this process using PowerShell.

By the end, you’ll understand:

  • When and why the SFTP adapter may require a restart.
  • How to identify and restart the correct BizTalk host instance.
  • How to restart it using PowerShell Script.
  • Best practices for keeping your SFTP-based integrations stable and efficient.

A small action that can make a big difference in your BizTalk environment’s reliability.

Once again, we face common challenges as BizTalk Server developers and administrators, one of which is the occasional instability or unexpected behavior of the SFTP adapter.

Over time, we’ve seen that the SFTP adapter may stop functioning as expected, failing to poll, silently dropping messages, or even becoming unresponsive. This behavior is often caused, maybe, by issues like:

  • Memory leaks in the SFTP adapter or underlying WinSCP sessions.

One of the most common workarounds that typically resolves these problems is simply restarting the Host Instance responsible for handling the SFTP adapter.

Today’s blog post provides a quick guide on how to restart a specific BizTalk Server Host Instance using a different and more powerful PowerShell script.

PowerShell to the Rescue!

First, we need to identify the Host Instance that’s running the SFTP Receive Location or Send Port. In most environments, this is a dedicated BizTalk Host (e.g., BizTalkSFTPHost) to isolate adapter-related behavior — a good practice, by the way!

You can restart this Host Instance using PowerShell in different ways. Today, we will be describing one of those methods.

Restart via Windows Service Name

Each BizTalk Host Instance is actually a Windows service named using this convention:

BTSSvc$<HostName>

So, if your SFTP Host Instance is called BizTalkSFTPHost, the Windows service is:

BTSSvc$BizTalkSFTPHost

To restart it, you can use the following script:

$hostName = "Your-sftp-BizTalk-Host-Instance-Name"     # Change this to your actual host name
$serviceName = "BTSSvc$"+ $hostName

Restart-Service -Name $serviceName

Why This Matters

The SFTP adapter is powerful, but like any component that relies on external libraries (in this case, the WinSCP .NET assembly), it can run into unmanaged memory issues over time. A periodic or reactive host instance restart is often the quickest and cleanest solution to restore full functionality.

Perhaps this is not the most elegant solution, but restarting the SFTP BizTalk Host Instance is a simple yet effective way to restore stability to your integrations when the adapter starts behaving erratically. Automating it via PowerShell enables you to integrate it into maintenance jobs or monitoring alerts, giving your BizTalk environment a self-healing touch.

Stay safe, script smart, and until the next post — happy integrations!

Download

THIS POWERSHELL SCRIPT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.

You can download the PowerShell Script used from GitHub here:

Hope you find this helpful! If you enjoyed the content or found it useful and wish to support our efforts to create more, you can contribute towards purchasing a Star Wars Lego for my son!

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.

Leave a Reply

Your email address will not be published. Required fields are marked *

The Ultimate Cloud
Management Platform for Azure

Supercharge your Azure Cost Saving

Learn More
Turbo360 Widget

Back to Top