Error 1231 — The Network Location Cannot Be Reached (net use Fix)
System error 1231 appears in PowerShell and Command Prompt when net use fails to map a network drive. Here is the exact cause and every fix.
What This Error Means
When running a net use command to map a network drive in Command Prompt or PowerShell:
net use Z: \\HOSTNAME\ShareName
You receive:
System error 1231 has occurred. The network location cannot be reached. For information about network troubleshooting, see Windows Help.
Error 1231 (0x000004CF) is a transport-level failure — Windows cannot establish a TCP connection to the target machine at the network level. This is different from authentication failures (wrong password) or share failures (wrong share name). The connection is not reaching the remote machine at all.
Root Cause 1 — The Target Machine Is Unreachable on the Network
Test this first:
ping HOSTNAME
Or:
Test-NetConnection -ComputerName HOSTNAME -Port 445
If ping fails or TcpTestSucceeded is False: the target machine is either off, on a different subnet, or blocking ICMP/TCP traffic at the network level.
Fix options:
- Confirm the target machine is powered on
- Confirm both machines are on the same network (same router)
- Try by IP address instead of hostname:
net use Z: \\192.168.1.45\ShareName
Root Cause 2 — IPv6 Preference Causing Resolution Failure
Windows sometimes resolves hostnames to IPv6 addresses even when the target machine is only accessible via IPv4. If the hostname resolves to an IPv6 address that is not actually routable on your LAN, the connection fails with 1231.
Test:
Resolve-DnsName HOSTNAME
If this returns an IPv6 address (starts with fe80:: or similar) instead of a 192.168.x.x IPv4 address, IPv6 is being preferred.
Fix:
Use the IPv4 address directly in the net use command:
net use Z: \\192.168.1.45\ShareName
Or temporarily disable IPv6 preference on the network adapter:
- Control Panel → Network Connections → right-click adapter → Properties
- Find "Internet Protocol Version 6 (TCP/IPv6)" → uncheck → OK
Root Cause 3 — Network Profile Set to Public on the Target
Fix on the target machine: Settings → Network and Internet → active connection → Network Profile Type → Private network
Machines on Public profile do not accept incoming SMB connections and appear as "unreachable" at the transport level.
Root Cause 4 — NetBIOS Over TCP/IP Disabled
net use with a hostname depends on NetBIOS Over TCP/IP (NBT) or LLMNR for name resolution in workgroup environments. If NBT is disabled:
Fix:
- Control Panel → Network Connections → right-click adapter → Properties → Internet Protocol Version 4 (TCP/IPv4) → Properties → Advanced
- WINS tab → NetBIOS setting → select "Enable NetBIOS over TCP/IP"
- OK → OK
Root Cause 5 — Firewall Blocking the Connection
Test port 445 directly:
Test-NetConnection -ComputerName 192.168.1.45 -Port 445
If TcpTestSucceeded = False when using IP address: port 445 is blocked on the target machine's firewall.
Fix on target machine: Control Panel → Windows Defender Firewall → Advanced Settings → Inbound Rules → find "File and Printer Sharing (SMB-In)" → Enable for the Private profile.
Root Cause 6 — Using net use With a Cached/Stale Session
If you have previously connected to the same share with different credentials, Windows may be trying to use a cached session.
Fix — clear existing connections:
net use * /delete /yes
Then retry the net use command.
Scripting net use Reliably
If you are scripting drive mapping (the most common reason for using net use), add error handling and the /persistent:no flag for non-persistent connections:
net use Z: \\192.168.1.45\Projects /user:USERNAME PASSWORD /persistent:yes
if %errorlevel% neq 0 (
echo Drive mapping failed with error %errorlevel%
pause
)
Using IP address instead of hostname in scripts eliminates name resolution as a failure mode.
Done troubleshooting Windows?
Oxolan fixes file sharing permanently. Installs in 2 minutes — no net use required.
Frequently Asked Questions
Error 1231 appears in a logon script but the same command works manually. Why?
Logon scripts run before network services are fully initialised. Add a ping -n 5 127.0.0.1 > nul delay at the start of the script to allow network services to start before the net use command runs.
net use succeeds but the drive disappears after restart. Why?
The /persistent:yes flag must be included. Alternatively, use Disk Management or the Map Network Drive wizard in File Explorer with "Reconnect at sign-in" checked.
Error 1231 with a VPN connected. Why? Some VPNs route all traffic through the VPN exit point, making your local network unreachable from Windows' perspective. Split tunnelling must be configured to route local network traffic directly rather than through the VPN. Contact your VPN provider for split tunnel configuration.
Can I automate this fix with a script? The services fix can be scripted. Create a PowerShell script that starts the four sharing services and schedule it at system startup via Task Scheduler. This prevents the services from remaining stopped after Windows Updates.
Done troubleshooting Windows?
Oxolan handles file sharing so you never have to think about this again.
Get Oxolan for Windows