if (-not (Test-Path $FolderPath)) Write-Error "Folder does not exist: $FolderPath" exit 1
)
Write-Host "Unblock operation completed on $($files.Count) files." powershell unblock all files in folder
If you find yourself doing this often, you can add an "Unblock Files" option to your right-click context menu. Here is a script that creates that menu item for you (run as Administrator): powershell unblock all files in folder
Get-ChildItem "C:\scripts" -Filter *.ps1 -Recurse | Unblock-File Set-ExecutionPolicy RemoteSigned -Scope CurrentUser powershell unblock all files in folder
$files | Unblock-File -WhatIf:$WhatIf