Let's say we have a hello.zip archive containing a hello.ps1 file. My question isn't specific to PowerShell, I'm merely using a PowerShell script as an example.
- Upload
hello.zipto a server. - Download
hello.zip - Recent versions of Windows will mark the file as unsafe and block it (
right-click -> Properties.
If I now uncompress hello.zip from the shell (right-click -> Extract All... or similar), the extracted files will carry over the blocking. If, however, the extraction happens from the command line, the uncompressed files will be unblocked.
In the case of the script above —with a RemoteSigned execution policy in place for PowerShell—, in the first case the script will be unable to run, whilst in the second it will execute normally.
I would like to understand why the blocking works differently depending on how the archive is uncompressed.