if ($Confirm -and $blockedFiles.Count -gt 0) $response = Read-Host "Unblock these $($blockedFiles.Count) files? (Y/N)" if ($response -ne 'Y') return
[Parameter(Mandatory=$false)] [switch]$Confirm ) get-childitem -recurse -file | unblock-file
Usage:
param( [Parameter(Mandatory=$false)] [string]$Path = ".", [Parameter(Mandatory=$false)] [switch]$WhatIf, if ($Confirm -and $blockedFiles
if ($WhatIf) $blockedFiles
Write-Host "Found $($blockedFiles.Count) blocked files" -ForegroundColor Cyan get-childitem -recurse -file | unblock-file
$blockedFiles | Unblock-File Write-Host "Unblocked $($blockedFiles.Count) files" -ForegroundColor Green