How to fix Error 4887 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 4887 – “Cannot open the file. Only disk files are supported.”

Why This Error Happens

This error typically occurs when SQL Server’s BACKUP or RESTORE command attempts to target a file path that isn’t recognized as a standard local or mapped disk resource, such as a UNC path without proper permissions, a named pipe, or a tape device reference that SQL Server 2025 no longer supports in the specified context. It can also happen if the SQL Server service account lacks the specific “Log on as a service” rights needed to traverse a network path, or if the backup string syntax contains invisible corrupted characters. Essentially, the Database Engine validates the destination as a “disk” device type and fails immediately if the path resolution returns anything ambiguous.

Step-by-Step Resolution Guide

Step 1: Verify the File Path Syntax

  • Open SQL Server Management Studio (SSMS) and review the exact BACKUP DATABASE or RESTORE T-SQL script being executed.
  • Ensure the path uses standard disk formatting (e.g., D:\Backups\MyDB.bak) rather than a URL or invalid protocol prefix.
  • If using a network share, ensure the UNC path is correctly formatted: \\ServerName\ShareName\File.bak.

Step 2: Validate Service Account Permissions

  • Open Services.msc on Windows Server 2025 and locate the “SQL Server (MSSQLSERVER)” service.
  • Check the “Log On” tab to identify the service account being used (e.g., NT Service\MSSQLSERVER or a domain account).
  • Grant this specific account “Read/Write” NTFS permissions on the target backup folder.
  • Restart the SQL Server service via PowerShell: Restart-Service -Name 'MSSQLSERVER' -Force.

Step 3: Check for Blocked Ports or Firewall Restrictions (Network Paths)

  • If the file resides on a remote server, verify that Windows Defender Firewall on the target machine allows SMB traffic (Port 445).
  • Use Test-NetConnection -ComputerName TargetServer -Port 445 in PowerShell to confirm connectivity.
  • Disable any third-party antivirus that might be intercepting disk I/O operations on the .bak file extension.

Step 4: Rebuild the Backup Device (If Applicable)

  • If using a named “Backup Device” rather than a raw path, drop the existing device using EXEC sp_dropdevice 'OldDeviceName';.
  • Recreate it with the correct physical path: EXEC sp_addumpdevice 'disk', 'NewDeviceName', 'D:\Backups\File.bak';.

Alternative or Verification Steps

  • Verification: Run a test backup using a local path directly on the C: or D: drive of the host machine (e.g., BACKUP DATABASE [TestDB] TO DISK = 'C:\Temp\test.bak') to confirm the engine itself is functioning correctly before re-testing the network path.
  • Alternative: If the UNC path continues to fail due to the “double-hop” authentication issue, configure a persistent mapped drive using net use Z: \\Server\Share /persistent:yes via the SQL Server Agent account context, or utilize Kerberos delegation instead of NTLM.