How to Clear the Windows Distributed File System (DFS) Namespace Cache via PowerShell

The Stale Referral Problem

In a massive enterprise with file servers scattered across the globe, users should not have to remember whether the HR files are on \\NYC-FS01\HR or \\LON-FS02\HR. The Windows Distributed File System (DFS) solves this by creating a logical unified namespace, like \\corp.com\Files\HR. When a user clicks this link, their computer asks a Domain Controller for a “referral”—the actual physical IP address of the server currently holding those files.

To reduce the load on the Domain Controllers, Windows caches these DFS referrals locally on the user’s computer. By default, this cache lasts for several hours. This is highly efficient until an IT administrator decides to decommission NYC-FS01 and migrate the files to a new server. The admin updates the DFS architecture, but the end-users’ computers are still holding onto the stale, cached referral pointing to the dead server. When the user clicks the \HR folder, they receive an immediate “Network Path Not Found” error.

To force the computer to immediately drop the dead link and request a fresh referral from the Domain Controller, you must clear the local DFS Namespace Cache using PowerShell.

Clearing the DFS Cache via PowerShell

Unlike the DNS cache (which can be flushed simply with ipconfig /flushdns), the DFS cache is managed by the Workstation service and the Multiple UNC Provider (MUP) driver in the kernel.

You must run these commands from an elevated PowerShell (Administrator) session on the affected client machine.

Step 1: Viewing the Current Cache

Before purging, it is helpful to see exactly what stale data the computer is holding onto.

Get-DfsClientCache

This will output a list of all current DFS targets and their Time-to-Live (TTL) expiration countdowns. If you see the dead server listed here, you know the cache is the culprit.

Step 2: Forcefully Purging the Cache

You can obliterate the entire DFS cache utilizing the native PKT (Partition Knowledge Table) flush command.

# Flush the DFS Partition Knowledge Table (PKT)
dfsutil /pktflush

The terminal will output: DFS Utility: PKT flushed.

Clearing Associated Caches

Because DFS relies heavily on DNS and Kerberos authentication tickets to actually access the physical server, a stale DFS link is often accompanied by stale DNS records.

To ensure a completely clean slate, you should sequentially purge the network, DNS, and Kerberos caches:

# 1. Flush the DNS Cache
Clear-DnsClientCache

# 2. Purge all Kerberos Authentication Tickets (forces re-authentication)
klist purge

# 3. Restart the Workstation Service (LanmanWorkstation)
# WARNING: This will drop any active file copies currently running in the background.
Restart-Service -Name LanmanWorkstation -Force

The Resolution

The next time the user opens File Explorer and navigates to \\corp.com\Files\HR, the Windows kernel will realize its PKT is empty. It will instantly perform a fresh DNS lookup for the domain, reach out to the nearest Active Directory Domain Controller, and receive the brand new referral pointing to the newly provisioned file server. The user will connect seamlessly without any “Path Not Found” errors.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.