-file | Unblock-file - Get-childitem -recurse

if ($Confirm -and $blockedFiles.Count -gt 0) $response = Read-Host "Unblock these $($blockedFiles.Count) files? (Y/N)" if ($response -ne 'Y') return

param( [Parameter(Mandatory=$false)] [string]$Path = ".", [Parameter(Mandatory=$false)] [switch]$WhatIf,

Write-Host "Found $($blockedFiles.Count) blocked files" -ForegroundColor Cyan get-childitem -recurse -file | unblock-file

$files = Get-ChildItem -Path $Path -Recurse -File $blockedFiles = @()

foreach ($file in $files) $hasZone = Get-Item $file.FullName -Stream Zone.Identifier -ErrorAction SilentlyContinue if ($hasZone) $blockedFiles += $file if ($Confirm -and $blockedFiles

if ($WhatIf) $blockedFiles

Usage:

.\Unblock-Tree.ps1 -Path "C:\MyFolder" -WhatIf # Preview only .\Unblock-Tree.ps1 -Path "C:\MyFolder" -Confirm # With confirmation The command Get-ChildItem -Recurse -File | Unblock-File is powerful but should be used carefully. Always preview blocked files first, understand where they came from, and only unblock files you completely trust. For daily use with your own scripts or trusted projects, it's a safe time-saver that eliminates the need to manually unblock hundreds of files.

4 comments

comments user
RedCap

Grazie con gratitudine per il vostro insostituibile lavoro..

comments user
Geppetto

GRAZIE

comments user
Geppetto

Password xxx

    comments user
    infotelematico

    Adultsonly01