PowerShell: set Zone.Identifier to simulate file being downloaded from the Internet
Some browsers mark a file that was being downloaded from the file by setting this file's alternate data streamZone.Identifier.
PowerShell relies on this information for example to determine if it should run a script.
The following example uses the PowerShell cmdlet set-content to fill the data stream Zone.Identifier, thus prepending that the file was downloaded from the Internet.
$filepath = "$pwd/simulate-downloaded-file.txt"
$url = 'https://someUrl.xyz/'
set-content $filepath @'
Prepend that this
file was downloaded
from the internet
'@
set-content $filepath -stream Zone.Identifier @"
[ZoneTransfer]
ZoneId=3
ReferrerUrl=$url
HostUrl=$url$(split-path -leaf $filepath)
"@