Set default file block behavior: registry value openinprotectedview (excel\security\fileblock)UserHKCU\software\policies\microsoft\office\16.0\excel\security\fileblock

Policy ID
L_SetDefaultFileBlockBehavior
Scope
User Configuration
Supported on
At least Windows Server 2008 R2 or Windows 7
Source
Microsoft 365 Apps / Office Administrative Templates (version 5568.1000)
Category
Microsoft Excel 2016 › Excel Options › Security › Trust Center › File Block Settings

Registry

openinprotectedview

REG_DWORDUser
Enabled value
Depends on the option value
Element
-
Options
ItemStored value
Blocked files are not opened0
Blocked files open in Protected View and can not be edited1
Blocked files open in Protected View and can be edited2
Apply with .reg · CMD · PowerShell
.reg
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\software\policies\microsoft\office\16.0\excel\security\fileblock]

; Options (use only one)
; Blocked files are not opened
"openinprotectedview"=dword:00000000
; Blocked files open in Protected View and can not be edited
"openinprotectedview"=dword:00000001
; Blocked files open in Protected View and can be edited
"openinprotectedview"=dword:00000002
CMD
:: Options (use only one)

:: Blocked files are not opened
reg add "HKCU\software\policies\microsoft\office\16.0\excel\security\fileblock" /v "openinprotectedview" /t REG_DWORD /d 0 /f
:: Blocked files open in Protected View and can not be edited
reg add "HKCU\software\policies\microsoft\office\16.0\excel\security\fileblock" /v "openinprotectedview" /t REG_DWORD /d 1 /f
:: Blocked files open in Protected View and can be edited
reg add "HKCU\software\policies\microsoft\office\16.0\excel\security\fileblock" /v "openinprotectedview" /t REG_DWORD /d 2 /f
PowerShell
# Common: create the key
New-Item -Path 'HKCU:\software\policies\microsoft\office\16.0\excel\security\fileblock' -Force | Out-Null

# Options (use only one)
# Blocked files are not opened
New-ItemProperty -Path 'HKCU:\software\policies\microsoft\office\16.0\excel\security\fileblock' -Name 'openinprotectedview' -PropertyType DWord -Value 0 -Force | Out-Null
# Blocked files open in Protected View and can not be edited
New-ItemProperty -Path 'HKCU:\software\policies\microsoft\office\16.0\excel\security\fileblock' -Name 'openinprotectedview' -PropertyType DWord -Value 1 -Force | Out-Null
# Blocked files open in Protected View and can be edited
New-ItemProperty -Path 'HKCU:\software\policies\microsoft\office\16.0\excel\security\fileblock' -Name 'openinprotectedview' -PropertyType DWord -Value 2 -Force | Out-Null