Handle Mark of the Web on downloaded files. - #41
Merged
Conversation
Leonid-Zakharov
approved these changes
Jul 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Short Story
Depending on how MSO-Scripts is downloaded and unzipped, the files may get the "Mark of the Web."
This causes PowerShell (depending on the execution policy) to either refuse to execute the script, or it requests approval for each script loaded: TraceCPU.ps1, INCLUDE.ps1, INCLUDE.WPA.ps1 (See Issue #39 for details.)
This pull request takes a two-pronged approach to neutralizing the Mark of the Web (MotW), based on the notion that PowerShell may be extra careful, but running the batch file wrapper will get the job done:
In both cases, a warning is emitted.
Another option would be to avoid adding this bit of code to all *.bat files, and instead create a "fix-it" script that you run after downloading/unzipping. However, that requires extra steps and documentation, and perhaps user frustration.
The Long Story
Windows implements MotW as a NTFS Alternate Stream named :Zone.Identifier , and containing specific text:
Each batch script is able to detect this alternate stream and null it out, but not remove it completely (without invoking PowerShell).
OR:
This executes when INCLUDE.ps1 loads: