Results 1 to 13 of 13
  1. #1
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts

    Windows 8.1+ UnBlocking files (maybe 7 too?)

    Hey Y'all,

    Recent versions of windows have a security feature that won't let some programs run if Windows detects that they were downloaded from the internet.

    In this specific case PowerShell programs. Usually I have my PowerShell, and instruct others to set theirs this way also, set to: Execution Policy RemoteSigned!

    Code:
    Set-ExecutionPolicy RemoteSigned
    It cam be checked with:
    Code:
    Get-ExecutionPolicy
    If you try to run a PS Script that Windows thinks you downloaded from the internet you will get this:
    Code:
    PS> G:\BEKDocs\Scripts\PowerShell 40 Best Practices Scripts\scripts_ch12\CheckProviderThenQuery.ps1
    File G:\BEKDocs\Scripts\PowerShell 40 Best Practices 
    Scripts\scripts_ch12\CheckProviderThenQuery.ps1 cannot be loaded. The file 
    G:\BEKDocs\Scripts\PowerShell 40 Best Practices 
    Scripts\scripts_ch12\CheckProviderThenQuery.ps1 is not digitally signed. You 
    cannot run this script on the current system. For more information about 
    running scripts and setting execution policy, see about_Execution_Policies at 
    http://go.microsoft.com/fwlink/?LinkID=135170.
        + CategoryInfo          : SecurityError: (:) [], ParentContainsErrorRecord 
       Exception
        + FullyQualifiedErrorId : UnauthorizedAccess
    Note: PS will let you load the program in the ISE but when you try to run it you get the message above.

    Fixes:

    In File Explorer right-click on the file and select Properties.
    On the General tab click the Unblock button.
    UnBlock File Dialog.PNG
    Click Apply -> Ok.

    Or

    Open the file in a program like Notepad++
    Of course that will get you this warning:
    Open File - Security Warning.PNG
    Click Open.
    Make a minor change then reverse it.
    Then Save it.

    Or

    Use the PowerShell CMDLET Unblock-File

    Code:
    PS> Unblock-File -path "G:\BEKDocs\Scripts\PowerShell 40 Best Practices Scripts\scripts_ch12\Get-Bios.ps1"
    
    PS> . "G:\BEKDocs\Scripts\PowerShell 40 Best Practices Scripts\scripts_ch12\Get-Bios.ps1"
    
    SMBIOSBIOSVersion : A00
    Manufacturer      : Dell Inc.
    Name              : A00
    SerialNumber      : 2TFQHX1
    Version           : DELL   - 20100118
    Of course you may run in to this problem with other files but now you have the tools to deal with them.

    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  2. #2
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,202
    Thanks
    49
    Thanked 987 Times in 917 Posts
    I always use the unblock method, immediately after a manual virus scan. This applies to all files downloaded via a browser, not necessarily via email or other means.

    cheers, Paul

  3. #3
    Silver Lounger wavy's Avatar
    Join Date
    Dec 2009
    Location
    ny
    Posts
    2,378
    Thanks
    235
    Thanked 147 Times in 136 Posts
    RG is that true for FF in W8? I have not noticed it in W7 w/FF, just w/ a d/l by MSIE.

    David

    Just because you don't know where you are going doesn't mean any road will get you there.

  4. #4
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    David,

    I made the post after downloading (via Pale Moon, FF fork) the example files for a PS book. So yes it does affect FF. I think it is determined by the type of file downloaded and how it was downloaded. The files I downloaded came via .ZIP file, which I unzipped to my Scripts directory. I haven't done any testing as to what file types/locations are affected but the point of the post is what to do if you encounter the problem however it is caused.

    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  5. #5
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Hey Y'all,

    Here's a PowerShell script that will Unblock an entire Directory Tree.

    Code:
    <#
    .SYNOPSIS
       Unblock all files in a specified directory and all it's
       sub-directories.
    
    .DESCRIPTION
       Downloading files from the internet may cause some files to be
       tagged with the BLOCKED attirbute. This program will remove the
       blocked status form all files in the specified directory (folder)
       and all its sub-directories(sub-folders).
    
       Programmed By: The Computer Mentor  aka RetiredGeek @ WSL
       Version      : 1.0
       Revision Date: 18 Jan 2016
    
    .PARAMETER PathToUnblock 
        A single directory/folder. 
        Manditory!
        User will be prompted if it is not provided. 
    
    .INPUTS  
        N/A
    .OUTPUTS
        N/A
    .NOTES
      Computer Mentors Unblock-FullDirectoryTree.ps1 Vers: 1.0     
    
    .EXAMPLE 
        PS C:\>Unblock-FullDirectoryTree.ps1 -PathToUnblock "C:\Users\Joe\Documents\Scripts"
    
    .EXAMPLE
        PS C:\>Unblock-FullDirectoryTree.ps1
    
    #>
    
    #Requires -Version 3.0
    
    Param (
    
     [Parameter(Mandatory=$true)]
         [String] $PathToUnblock 
    )
    
    #---------------  Main Program ---------------------
    
    If (Test-Path -Path "$pathToUnblock") {
    
       $FileCount = 0 
    
       Get-ChildItem -path "$PathToUnblock" -recurse |
       ForEach-Object {
                        Unblock-File -path "$($_.FullName)"
                        $FileCount += 1
       }  #ForEach-Object
    
       Write-Host "`n`n$FileCount File(s) processed.`n`n"
    
    }
    
    Else {
      Write-Host "`n`n$PathToUnblock - is not a valid d:\path`n`n"
    }
    The UI is basic (may improve later) but it does it's job.

    HTH
    Last edited by RetiredGeek; 2016-01-18 at 15:54.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  6. The Following User Says Thank You to RetiredGeek For This Useful Post:

    wavy (2016-01-19)

  7. #6
    Super Moderator Rick Corbett's Avatar
    Join Date
    Dec 2009
    Location
    South Glos., UK
    Posts
    2,143
    Thanks
    101
    Thanked 580 Times in 464 Posts
    Hi RG - yes, it's an issue in Win 7 too. Thanks for the thread, advice and PS script.

  8. #7
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Hey Y'all,

    Here's an updated version that will provide you with a dialog box to pick your top level directory if you either don't provide one or provide an invalid one.

    UnblockBrowser.PNG

    If you press Cancel in the browser dialog above:
    UnblockErrormsg.PNG

    Successful completion:
    unblockstatus.PNG

    Unblock-FullDirectoryTree Version 2: Unblock-FullDirectoryTree.zip

    As always feedback is welcome.

    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  9. #8
    5 Star Lounger
    Join Date
    Jan 2002
    Location
    Midlothian, Virginia, USA
    Posts
    875
    Thanks
    0
    Thanked 2 Times in 1 Post
    When I right-click on qw.exe and select Properties on my Win8.1 system the General tab does not show that unblock item that is shown in the picture in the first message in this thread. But, when I click the Quicken shortcut (to qw.exe) in my Quick Launch toolbar I am always prompted with the Open File - Security Warning dialog that I have to click before Quicken will open. I'm wondering why my system is different from the others discussed here?

    Thanks,
    Bill

  10. #9
    Silver Lounger wavy's Avatar
    Join Date
    Dec 2009
    Location
    ny
    Posts
    2,378
    Thanks
    235
    Thanked 147 Times in 136 Posts
    Quote Originally Posted by RetiredGeek View Post
    David,

    I made the post after downloading (via Pale Moon, FF fork) the example files for a PS book. So yes it does affect FF. I think it is determined by the type of file downloaded and how it was downloaded. The files I downloaded came via .ZIP file, which I unzipped to my Scripts directory. I haven't done any testing as to what file types/locations are affected but the point of the post is what to do if you encounter the problem however it is caused.

    HTH
    Maybe its because I have W7 and you have W81. I do not seem to have the unblock option in any PM d/l. I do if I d/l the same file w/ MSIE.

    David

    Just because you don't know where you are going doesn't mean any road will get you there.

  11. #10
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,202
    Thanks
    49
    Thanked 987 Times in 917 Posts
    Quote Originally Posted by BillWilson View Post
    But, when I click the Quicken shortcut (to qw.exe) in my Quick Launch toolbar I am always prompted with the Open File - Security Warning dialog that I have to click before Quicken will open
    Bill, that is explained in your other thread.

    cheers, Paul

  12. #11
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Quote Originally Posted by wavy View Post
    Maybe its because I have W7 and you have W81. I do not seem to have the unblock option in any PM d/l. I do if I d/l the same file w/ MSIE.
    David,

    This got me curious so I fired up my Dual-Boot laptop that still has W7-HP and tested. I get the same thing as you! If downloaded via Pale Moon you do NOT get the Unblock button on the file properties, however download the same files w/IE 11 and all the files have the Unblock button present!

    So it's not just your machine it's something in Win 7 IE that was apparently then baked-into Win 8 at the OS level.

    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  13. #12
    Super Moderator satrow's Avatar
    Join Date
    Dec 2009
    Location
    Cardiff, UK
    Posts
    4,492
    Thanks
    284
    Thanked 577 Times in 480 Posts
    Like Smart Screen.

  14. #13
    5 Star Lounger
    Join Date
    Jan 2002
    Location
    Midlothian, Virginia, USA
    Posts
    875
    Thanks
    0
    Thanked 2 Times in 1 Post
    Quote Originally Posted by RetiredGeek View Post
    David,

    This got me curious so I fired up my Dual-Boot laptop that still has W7-HP and tested. I get the same thing as you! If downloaded via Pale Moon you do NOT get the Unblock button on the file properties, however download the same files w/IE 11 and all the files have the Unblock button present!

    So it's not just your machine it's something in Win 7 IE that was apparently then baked-into Win 8 at the OS level.

    HTH
    Well, not baked into all Win8.1 systems! Mine is Win8.1 and I've used only IE 11 to retrieve programs from the Internet. For example, some time ago I installed "ScreenHunter 6.0 Free" and I have a link to it in my new Quick Launch toolbar. When I click on that entry in the toolbar I am prompted with the Open File - Security Warning dialog. When I look at the properties of the exe file that link is pointing to it does not show the Unblock button. The same problem applies to programs that I have installed from the installation disks that I bought from a retail store. My Quicken is an example of that.

    I'm still hoping that a solution for this will pop up so I'll keep on reading these posts.

    Thanks for working on it.
    Bill

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •