How to Fix PowerShell SMTP net_io_connectionclosed Error in Windows
Question details
The user needs to resolve an SMTP transport error when sending emails via a PowerShell script on an older Windows 10 build.

- 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.
Ensure you have administrative privileges on the Windows 10 LTSB machine and verify that your network firewall allows outbound traffic on port 587.
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.
Right-click your PowerShell email script and open it in PowerShell ISE or your preferred text editor.
At the very beginning of your script, add the following line: [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Ensure that your Send-MailMessage command includes the -UseSsl parameter to enable encrypted communication.
Save the script, run it as Administrator, and verify that the connection to smtp.office365.com is successful.

Verify SMTP Credentials and App Passwords
Microsoft 365 often disables basic authentication. You may need an App Password to authenticate the SMTP connection successfully.
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. Visit the official site: Go to the WPS Office website to access the latest secure installer.
- 2. Download the software: Click the Free Download button to get the lightweight installation package.
- 3. Install and use: Run the installer, open the application, and seamlessly edit your Microsoft Office files.

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.




