CmdID

CmdID / PowerShell / Cmdlets / Unblock

Unblock-File

Unblocks files that were downloaded from the internet. PowerShell reference

From the PowerShell reference 4 parameters

Opens CmdID with your command, read as PowerShell. It is read in your browser and sent nowhere.

What it does

from the PowerShell reference, CC BY 4.0

Unblocks files that were downloaded from the internet. The Unblock-File cmdlet lets you open files that were downloaded from the internet. It unblocks PowerShell script files that were downloaded from the internet so you can run them, even when the PowerShell execution policy is RemoteSigned. By default, these files are blocked to protect the computer from untrusted files. Before using the Unblock-File cmdlet, review the file and its source and verify that it is safe to open. Internally, the Unblock-File cmdlet removes the Zone.Identifier alternate data stream, which has a value of 3 to indicate that it was downloaded from the internet. For more information about PowerShell execution policies, see about_Execution_Policies. This cmdlet was introduced in Windows PowerShell 3.0.

Unblock-File [-Path] <String[]> [-WhatIf] [-Confirm] [<CommonParameters>]
Unblock-File -LiteralPath <String[]> [-WhatIf] [-Confirm] [<CommonParameters>]

Unblock a file

PS C:> Unblock-File -Path C:\Users\User01\Documents\Downloads\PowerShellTips.chmIdentify

Unblock multiple files

PS C:> dir C:\Downloads\PowerShell | Unblock-FileIdentify

Find and unblock scripts

PS C:> Get-Item * -Stream "Zone.Identifier" -ErrorAction SilentlyContinue FileName: C:\ps-test\Start-ActivityTracker.ps1 Stream Length ------ ------ Zone.Identifier 26 PS C:> C:\ps-test\Start-ActivityTracker.ps1 C:\ps-test\Start-ActivityTracker.ps1 : File C:\ps-test\Start-ActivityTracker.ps1 cannot be loaded. The file C:\ps-test\Start-ActivityTracker.ps1 is not digitally signed. The script will not execute on the system. For more information, see about_Execution_Policies. At line:1 char:1 + C:\ps-test\Start-ActivityTracker.ps1 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : SecurityError: (:) [], PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess PS C:> Get-Item C:\ps-test\Start-ActivityTracker.ps1 | Unblock-FileIdentify

Its page in the reference: Unblock-File.

Parameters

4 in the PowerShell reference
-LiteralPathSpecifies the files to unblock. Unlike Path, the value of the LiteralPath parameter is used exactly as it is typed. No characters are interpreted as wildcards. If the path includes escape characters, enclose it in single quotation marks ('). Single quotation marks tell PowerShell not to interpret any characters as escape sequences.
-PathSpecifies the files to unblock. Wildcard characters are supported.
-ConfirmPrompts you for confirmation before running the cmdlet.
-WhatIfShows what would happen if the cmdlet runs. The cmdlet is not run.