Macro Runtime Scan Scope
| Registry value | macroruntimescanscope |
| Group Policy | Macro Runtime Scan Scope |
| German version | Umfang der Makrolaufzeitüberprüfung |
| Intune settings catalog | Macro Runtime Scan Scope (User) |
| Scope | User · HKCU |
| ADMX | office16.admx · L_MacroRuntimeScanScope |
Group Policy path
Registry
| Value | Data |
|---|---|
HKCU\Software\policies\microsoft\office\16.0\common\security | |
| macroruntimescanscope | 0 = Disable for all documents · 1 = Enable for low trust documents · 2 = Enable for all documents · 3 = Scan excluding documents marked as trusted by an admin |
Not configured = the value does not exist – the application default applies and users may change the setting.
PowerShell
Check the current value (read-only)
# --- Settings ---
$root = 'HKCU:' # other signed-in user (elevated): 'Registry::HKEY_USERS\<SID>'
$key = "$root\Software\policies\microsoft\office\16.0\common\security"
foreach ($name in @('macroruntimescanscope')) {
try { '{0} = {1}' -f $name, (Get-ItemPropertyValue -Path $key -Name $name -ErrorAction Stop) }
catch { '{0}: not configured' -f $name }
}Admin rights needed: HKCU\Software\Policies is read-only for standard users. An elevated session writes to the admin's own HKCU – to set it for another signed-in user, change $root to Registry::HKEY_USERS\<SID>.
Enable
# --- Settings ---
$root = 'HKCU:' # other signed-in user (elevated): 'Registry::HKEY_USERS\<SID>'
try {
$key = "$root\Software\policies\microsoft\office\16.0\common\security"
if (-not (Test-Path $key)) { New-Item -Path $key -Force -ErrorAction Stop | Out-Null }
New-ItemProperty -Path $key -Name 'macroruntimescanscope' -PropertyType DWord -Value 0 -Force -ErrorAction Stop | Out-Null # options: 0 = Disable for all documents, 1 = Enable for low trust documents, 2 = Enable for all documents, 3 = Scan excluding documents marked as trusted by an admin
'Done.'
}
catch { Write-Error "Failed: $($_.Exception.Message)" }Reset to Not configured
# --- Settings --- $root = 'HKCU:' # other signed-in user (elevated): 'Registry::HKEY_USERS\<SID>' $key = "$root\Software\policies\microsoft\office\16.0\common\security" Remove-ItemProperty -Path $key -Name 'macroruntimescanscope' -ErrorAction SilentlyContinue 'Policy values removed (Not configured).'
Intune (settings catalog)
Macro Runtime Scan Scope (User)
Settings catalog → Add settings → search for the name above.
Intune Settings Catalog Viewer ↗
Alternative: custom profile (OMA-URI)
| OMA-URI | ./User/Vendor/MSFT/Policy/Config/office16v2~Policy~L_MicrosoftOfficeSystem~L_SecuritySettings/L_MacroRuntimeScanScope |
| Data type | String |
| Value | <enabled/> · <disabled/> |
This policy has options: add one <data id="…" value="…"/> per element after <enabled/>. The element IDs are in the ADMX file.
Cloud Policy
Cloud Policy (config.office.com → Customization → Policy Management) offers many user policies of the Microsoft 365 Apps – search for Macro Runtime Scan Scope. It also applies to unmanaged devices and wins over GPO and Intune for the same setting.
Microsoft explanation
This policy setting specifies the behavior for both the VBA and Excel 4.0 (XLM) runtime scan features. Multiple Office apps support VBA macros, but XLM macros are only supported by Excel. Macros can only be scanned if the anti-virus software registers as an Antimalware Scan Interface (AMSI) provider on the device.
If you enable this policy setting, you can choose from the following options to determine the macro runtime scanning behavior:
- Disable for all files (not recommended): If you choose this option, no runtime scanning of enabled macros will be performed.
- Enable for low trust files: If you choose this option, runtime scanning will be enabled for all files for which macros are enabled, except for the following files:
- Files opened while macro security settings are set to “Enable All Macros”
- Files opened from a Trusted Location
- Files that are Trusted Documents
- Files that contain VBA that is digitally signed by a Trusted Publisher
- Enable for all files: If you choose this option, then low trust files are not excluded from runtime scanning.
- Enable for files, excluding documents marked as trusted by an admin: If you choose this option, runtime scanning will be enabled for all files for which macros are enabled, except for the following files:
- Files opened from a Trusted Location
- Files that contain VBA that is digitally signed by a Trusted Publisher
The VBA and XLM runtimes report to an antivirus system certain high-risk code behaviors the macro is about to execute. This allows the antivirus system to indicate whether or not the macro behavior is malicious. If the behavior is determined to be malicious, the Office application closes the session and the antivirus system can quarantine the file. If the behavior is non-malicious, the macro execution proceeds.
Note: When macro runtime scanning is enabled, the runtime performance of affected VBA projects and XLM sheets may be reduced.
If you disable this policy setting, no runtime scanning of enabled macros will be performed.
If you don’t configure this policy setting, “Enable for low trust files” will be the default setting.
Note: This policy setting only applies to subscription versions of Office, such as Microsoft 365 Apps for enterprise.
Same category: Microsoft Office 2016 › Security Settings
- Disable 3D Model File Formats Listmodel3dblockextlist
- Check OWC data source providerscheckowcsafeproviders
- Check Excel RTD serverscheckexcelcreatertd
- Check OLE objectscheckofficeole
- Check ActiveX objectscheckofficeactivex
- Set password hash format as ISO-compliantuseisopasswordverifier
- Encrypt document propertiesencryptdocprops
- Block OrgChartblockorgchart
- Block OLE Graphblockolegraph
- Turn off PDF encryption setting UIenableencryption
- Set minimum password lengthminlength
- Set password rules levelpolicylevel
All policies in this category · All 945 policies of office16.admx