Block a file with Powershell

3.4k Views Asked by At

I want to block (not unblock) a file with Powershell. I want to cause Windows to believe that a file on disk was downloaded from the internet, or whatever other scenario exists such that files become blocked. I need this to test how some software I'm developing behaves in the presence of a blocked file.

1

There are 1 best solutions below

2
Nacimota On BEST ANSWER

If you're just trying to add the zone identifier you could try something like this:

$data = "[ZoneTransfer]
ZoneId=3"

Set-Content example.txt -Stream "Zone.Identifier" -Value $data