locked
UnBlock Using "echo.>MyExe.exe:Zone.Identifier' RRS feed

  • Question

  • I wrote the following cmd script to to install a windows service. The files are downloaded from a dev server using a web browser, so they need to be unblocked. InstallUtil.exe will fail with a file not found error, if the file is from a network location and blocked. This script works great but is an enigma to me.

    REM Unblock files

    echo.>MyExe.exe:Zone.Identifier
    echo.>MyExe.exe.config:Zone.Identifier
    echo.>MyExe.pdb:Zone.Identifier
    echo.>MyExe.vshost.exe:Zone.Identifier
    echo.>MyExe.vshost.exe.config:Zone.Identifier
    echo.>MyDll.dll:Zone.Identifier
    echo.>MyDll.pdb:Zone.Identifier
    echo.>MyOtherDll.dll:Zone.Identifier
    echo.>MyOtherDll.pdb:Zone.Identifier

    REM Install Service

    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe MyExe.exe

    I do not understand why echo.>MyExe.exe:Zone.Identifier unblocked the file.

    Can you explain this to me?
    What is echo. doing pn this context and why does it work?
    Am I rewriting all the files or just setting the file zones to local?



    • Edited by Allen Alper Monday, January 20, 2020 1:03 AM
    Monday, January 20, 2020 12:59 AM

Answers

  • It is sending a blank line to the "Zone" alternate stream named "identifier" for some undeclared reason. Perhaps it is to clear the identifier stream.


    \_(ツ)_/

    • Marked as answer by Allen Alper Monday, January 20, 2020 3:13 AM
    Monday, January 20, 2020 1:21 AM
  • This may help with this code and why:

    https://hshrzd.wordpress.com/2016/03/19/introduction-to-ads-alternate-data-streams/ 


    \_(ツ)_/

    • Marked as answer by Allen Alper Monday, January 20, 2020 3:13 AM
    Monday, January 20, 2020 1:29 AM
  • So I played around with this. When you down load a file from the AWS and type this into the command console:

    more < MyExe.exe:Zone.Identifier

    You get something like this:

    [ZoneTransfer]
    ZoneId=3
    ReferrerUrl=https://s3.console.aws.amazon.com/...
    HostUrl=https://crawler-uploads.s3.us-east-1.amazonaws.com/...

    Zone 1 is Intranet
    Zone 2 is Trusted
    Zone 3 is Internet
    Zone 4 is Untrusted

    after:

    echo.>MyExe.exe:Zone.Identifier

    more < MyExe.exe:Zone.Identifier returns:


    (two blank lines)

    All the Zone.Identifier info was overwritten by the echo. which sent the blank line to the Zone Stream.

    Because the Zone is no longer ZoneId=3 (Internet).
    It is no longer seen as coming from the internet and it does not need to be unblocked.

    InstallUtil.exe will run without an error.

    • Edited by Allen Alper Monday, January 20, 2020 3:40 AM
    • Marked as answer by Allen Alper Monday, January 20, 2020 3:41 AM
    Monday, January 20, 2020 3:29 AM

All replies

  • It is sending a blank line to the "Zone" alternate stream named "identifier" for some undeclared reason. Perhaps it is to clear the identifier stream.


    \_(ツ)_/

    • Marked as answer by Allen Alper Monday, January 20, 2020 3:13 AM
    Monday, January 20, 2020 1:21 AM
  • This may help with this code and why:

    https://hshrzd.wordpress.com/2016/03/19/introduction-to-ads-alternate-data-streams/ 


    \_(ツ)_/

    • Marked as answer by Allen Alper Monday, January 20, 2020 3:13 AM
    Monday, January 20, 2020 1:29 AM
  • So I played around with this. When you down load a file from the AWS and type this into the command console:

    more < MyExe.exe:Zone.Identifier

    You get something like this:

    [ZoneTransfer]
    ZoneId=3
    ReferrerUrl=https://s3.console.aws.amazon.com/...
    HostUrl=https://crawler-uploads.s3.us-east-1.amazonaws.com/...

    Zone 1 is Intranet
    Zone 2 is Trusted
    Zone 3 is Internet
    Zone 4 is Untrusted

    after:

    echo.>MyExe.exe:Zone.Identifier

    more < MyExe.exe:Zone.Identifier returns:


    (two blank lines)

    All the Zone.Identifier info was overwritten by the echo. which sent the blank line to the Zone Stream.

    Because the Zone is no longer ZoneId=3 (Internet).
    It is no longer seen as coming from the internet and it does not need to be unblocked.

    InstallUtil.exe will run without an error.

    • Edited by Allen Alper Monday, January 20, 2020 3:40 AM
    • Marked as answer by Allen Alper Monday, January 20, 2020 3:41 AM
    Monday, January 20, 2020 3:29 AM
  • In PowerShell:

    Unblock-File file.ext

    Give up on batch. It is obsolete and soon to be removed from Windows.


    \_(ツ)_/

    Monday, January 20, 2020 3:32 AM