Others

How to Fix PowerShell SMTP net_io_connectionclosed Error in Windows

Khadija KhanKhadija Khan Nov 3, 2026 868 views

Question details

The user needs to resolve an SMTP transport error when sending emails via a PowerShell script on an older Windows 10 build.

How to Fix PowerShell SMTP net_io_connectionclosed Errors
Product
PowerShell / Office 365 SMTP
Device & OS
Windows 10 Enterprise 2016 LTSB
Scenario
Running a PowerShell email script to connect to smtp.office365.com on port 587.
Observed behavior
The script fails with a net_io_connectionclosed transport error on the LTSB version, despite working successfully on a Windows 10 Pro machine.
Before you start

Ensure you have administrative privileges on the Windows 10 LTSB machine and verify that your network firewall allows outbound traffic on port 587.

Solution 1Recommended

Force PowerShell to Use TLS 1.2

Office 365 SMTP requires TLS 1.2. Older operating systems like Windows 10 LTSB 2016 may default to older, unsupported TLS versions, causing the connection to be abruptly closed.

Microsoft has deprecated older TLS versions for Exchange Online. Since Windows 10 Enterprise 2016 LTSB defaults to older protocols in PowerShell, you must explicitly declare TLS 1.2 in your script.

1
Open PowerShell script

Right-click your PowerShell email script and open it in PowerShell ISE or your preferred text editor.

2
Add the TLS 1.2 enforcement command

At the very beginning of your script, add the following line: [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

3
Verify SSL parameters

Ensure that your Send-MailMessage command includes the -UseSsl parameter to enable encrypted communication.

4
Save and test

Save the script, run it as Administrator, and verify that the connection to smtp.office365.com is successful.

Force PowerShell to Use TLS 1.2
Connection Restored: Forcing TLS 1.2 directly resolves the transport error caused by Microsoft 365 rejecting outdated security protocols.
Free Microsoft Office alternative

Switch to WPS Office for a Lightweight Document Experience

Troubleshooting complex Microsoft 365 background services and PowerShell scripts can be time-consuming. If you are looking for a hassle-free, lightweight solution for your daily document tasks, WPS Office offers a highly compatible alternative with a familiar interface.

  1. 1. Visit the official site: Go to the WPS Office website to access the latest secure installer.
  2. 2. Download the software: Click the Free Download button to get the lightweight installation package.
  3. 3. Install and use: Run the installer, open the application, and seamlessly edit your Microsoft Office files.
Fully compatible with Microsoft Office formats (.docx, .xlsx, .pptx).Free and lightweight, avoiding complex system service dependencies.Built-in PDF editing and powerful productivity tools.Familiar user interface for seamless and quick migration.
microsoft office alternative - wps office

Frequently Asked Questions

What causes the net_io_connectionclosed error in PowerShell?

This usually happens when the SMTP server (like Office 365) abruptly closes the connection, often due to mismatched TLS protocols, blocked ports, or unsupported authentication methods.

Why does the script work on Windows 10 Pro but not on Windows 10 Enterprise LTSB?

Windows 10 Enterprise 2016 LTSB is based on an older build of Windows 10. By default, PowerShell on this version attempts to use older TLS versions (like TLS 1.0) which Microsoft 365 no longer supports, whereas newer Windows 10 Pro builds use TLS 1.2 by default.

Does the -UseSsl parameter in PowerShell force TLS 1.2?

No, the -UseSsl parameter simply tells PowerShell to use encrypted communication, relying on the operating system's default security protocol. You must explicitly define TLS 1.2 in your script for older Windows versions.