巨集執行階段掃描範圍 的登錄值 macroruntimescanscope使用者HKCU\software\policies\microsoft\office\16.0\common\security

原則 ID
L_MacroRuntimeScanScope
適用範圍
使用者設定
支援的作業系統
至少需要 Windows Server 2016、Windows 10
來源
Microsoft 365 Apps / Office Administrative Templates (版本 5568.1000)
類別
Microsoft Office 2016 › 安全性設定

登錄

macroruntimescanscope

REG_DWORD使用者
啟用時的值
取決於選項值
元素
-
選項
項目儲存的值
對所有文件停用0
對低度信任文件啟用1
對所有文件啟用2
Scan excluding documents marked as trusted by an admin3
以 .reg · CMD · PowerShell 套用
.reg
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\software\policies\microsoft\office\16.0\common\security]

; 選項 (只使用其中一個)
; 對所有文件停用
"macroruntimescanscope"=dword:00000000
; 對低度信任文件啟用
"macroruntimescanscope"=dword:00000001
; 對所有文件啟用
"macroruntimescanscope"=dword:00000002
; Scan excluding documents marked as trusted by an admin
"macroruntimescanscope"=dword:00000003
CMD
:: 選項 (只使用其中一個)

:: 對所有文件停用
reg add "HKCU\software\policies\microsoft\office\16.0\common\security" /v "macroruntimescanscope" /t REG_DWORD /d 0 /f
:: 對低度信任文件啟用
reg add "HKCU\software\policies\microsoft\office\16.0\common\security" /v "macroruntimescanscope" /t REG_DWORD /d 1 /f
:: 對所有文件啟用
reg add "HKCU\software\policies\microsoft\office\16.0\common\security" /v "macroruntimescanscope" /t REG_DWORD /d 2 /f
:: Scan excluding documents marked as trusted by an admin
reg add "HKCU\software\policies\microsoft\office\16.0\common\security" /v "macroruntimescanscope" /t REG_DWORD /d 3 /f
PowerShell
# 共通: 建立機碼
New-Item -Path 'HKCU:\software\policies\microsoft\office\16.0\common\security' -Force | Out-Null

# 選項 (只使用其中一個)
# 對所有文件停用
New-ItemProperty -Path 'HKCU:\software\policies\microsoft\office\16.0\common\security' -Name 'macroruntimescanscope' -PropertyType DWord -Value 0 -Force | Out-Null
# 對低度信任文件啟用
New-ItemProperty -Path 'HKCU:\software\policies\microsoft\office\16.0\common\security' -Name 'macroruntimescanscope' -PropertyType DWord -Value 1 -Force | Out-Null
# 對所有文件啟用
New-ItemProperty -Path 'HKCU:\software\policies\microsoft\office\16.0\common\security' -Name 'macroruntimescanscope' -PropertyType DWord -Value 2 -Force | Out-Null
# Scan excluding documents marked as trusted by an admin
New-ItemProperty -Path 'HKCU:\software\policies\microsoft\office\16.0\common\security' -Name 'macroruntimescanscope' -PropertyType DWord -Value 3 -Force | Out-Null