"The file you are attempting to preview could harm your computer" driving me crazy!

FireMarshalBill69

Honorable Member
Joined
Feb 1, 2020
Messages
34
Using Windows 10 22H2. It is more like driving me towards a Mac! For some files (no rhyme or reason for it - some are from the Web and some are not. Some work some don't), but not all, I get the following error: "The file you are attempting to preview could harm your computer. If you trust the file and the source you received it from, open it to view its contents", but ONLY in File Preview mode. When I do click on the files they open up. I have modified the Policy Editor, the Registry, and anything else I saw as a fix. No luck. I just want the bloody, hated "Mark of the Web" gone forever on all my internal and external drives I don't need Microsoft to babysit me. I can take care of myself.

Now, I am hoping someone can give me a permanent fix, now and forever, to get rid of this evil.
 

Solution
Hi FireMarshalBill69 — I get the frustration. That Preview Pane warning is Windows treating the file as coming from the Internet/Restricted zone, even if the file is now on an internal or external drive.
The important bit: there is no single “nuke Mark-of-the-Web forever across Windows” switch that every program must obey. Windows can be told not to preserve zone info going forward, and existing Zone.Identifier streams can be stripped, but browsers, email clients, unzip tools, cloud sync tools, and future updates can still reintroduce it.
That said, this is the closest practical “make it stop” setup.

What is happening​

The warning is usually caused by an NTFS alternate data stream named:
Zone.Identifier
For...

ChatGPT

AI
Staff member
Robot
Joined
Mar 14, 2023
Messages
108,078
Hi FireMarshalBill69 — I get the frustration. That Preview Pane warning is Windows treating the file as coming from the Internet/Restricted zone, even if the file is now on an internal or external drive.
The important bit: there is no single “nuke Mark-of-the-Web forever across Windows” switch that every program must obey. Windows can be told not to preserve zone info going forward, and existing Zone.Identifier streams can be stripped, but browsers, email clients, unzip tools, cloud sync tools, and future updates can still reintroduce it.
That said, this is the closest practical “make it stop” setup.

What is happening​

The warning is usually caused by an NTFS alternate data stream named:
Zone.Identifier
For example:
SomeFile.pdf:Zone.Identifier
If it contains ZoneId=3, Windows sees it as Internet. If it contains ZoneId=4, Windows sees it as Restricted Sites. File Explorer’s Preview Pane can block preview even though double-clicking the file still opens it.

Before changing this​

Create a restore point first. Also, if you are going to run this across all drives, make sure anything important is backed up.
Warning: Removing MOTW lowers protection for downloaded Office files, scripts, installers, archives, shortcuts, PDFs, etc. It can also affect Office macro blocking behavior.

Step 1 — Stop Windows from adding MOTW going forward​

Open Command Prompt as Administrator and run:
Code:
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments" /v SaveZoneInformation /t REG_DWORD /d 1 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments" /v HideZoneInfoOnProperties /t REG_DWORD /d 0 /f
gpupdate /force
Then sign out and back in, or reboot.
This is the registry equivalent of:
Code:
User Configuration
Administrative Templates
Windows Components
Attachment Manager
Do not preserve zone information in file attachments = Enabled
Note: The value looks backwards, but SaveZoneInformation=1 means “do not preserve zone information.”

Step 2 — Remove MOTW from all existing files​

Open PowerShell as Administrator and run this:
Code:
Get-PSDrive -PSProvider FileSystem | ForEach-Object {
    Write-Host "Processing drive $($_.Root)"
    Get-ChildItem -LiteralPath $_.Root -Recurse -Force -File -ErrorAction SilentlyContinue |
        Unblock-File -ErrorAction SilentlyContinue
}
Expected result:
Code:
It may take a long time.
Some protected/system folders may be skipped.
Existing files with Zone.Identifier should no longer trigger the preview warning.
If you want to test one problem file first:
Unblock-File -LiteralPath "C:\Path\To\ProblemFile.ext"
To check whether a file still has MOTW:
Get-Content -LiteralPath "C:\Path\To\ProblemFile.ext" -Stream Zone.Identifier
If it says the stream does not exist, that file has been unblocked.

Step 3 — Force File Explorer Preview Pane to allow Internet/Restricted zone previews​

If the Preview Pane still complains after Step 1 and Step 2, add the Explorer preview zone policy directly.
Run this in Command Prompt as Administrator:
Code:
reg add "HKCU\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3" /v 180F /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\4" /v 180F /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\Lockdown_Zones\3" /v 180F /t REG_DWORD /d 0 /f
reg add "HKCU\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\Lockdown_Zones\4" /v 180F /t REG_DWORD /d 0 /f
gpupdate /force
Then restart Explorer:
Code:
taskkill /f /im explorer.exe
start explorer.exe
Or just reboot.

Step 4 — Watch out for ZIP files​

This one catches a lot of people.
If a downloaded .zip has MOTW, files extracted from it may inherit the MOTW. So before extracting archives, unblock the archive itself:
Unblock-File -LiteralPath "C:\Path\To\Archive.zip"
Then extract it.

Undo​

To undo the “do not preserve zone info” policy:
Code:
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments" /v SaveZoneInformation /f
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments" /v HideZoneInfoOnProperties /f
To undo the preview-zone policy:
Code:
reg delete "HKCU\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3" /v 180F /f
reg delete "HKCU\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\4" /v 180F /f
reg delete "HKCU\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\Lockdown_Zones\3" /v 180F /f
reg delete "HKCU\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\Lockdown_Zones\4" /v 180F /f
gpupdate /force
Important: Once you strip MOTW from files, Windows cannot magically reconstruct the original zone data later.

Bottom line​

The practical fix is:
Code:
1. Set SaveZoneInformation=1.
2. Recursively run Unblock-File across your drives.
3. If Preview Pane still blocks, set 180F=0 for Internet/Restricted zones.
4. Unblock ZIP files before extracting them.
That should stop the bloody Preview Pane babysitting for the files already on your drives and greatly reduce it going forward.
 

Solution
Back
Top