Automation Security: registry value automationsecurityUserHKCU\software\policies\microsoft\office\common\security

Policy ID
L_AutomationSecurity
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 Office 2016 › Security Settings

Registry

automationsecurity

REG_DWORDUser
Enabled value
Depends on the option value
Element
Set the Automation Security level
Options
ItemStored value
Disable macros by default3
Use application macro security level2
Macros enabled (default)1
Apply with .reg · CMD · PowerShell
.reg
Windows Registry Editor Version 5.00

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

; Options (use only one)
; Disable macros by default
"automationsecurity"=dword:00000003
; Use application macro security level
"automationsecurity"=dword:00000002
; Macros enabled (default)
"automationsecurity"=dword:00000001
CMD
:: Options (use only one)

:: Disable macros by default
reg add "HKCU\software\policies\microsoft\office\common\security" /v "automationsecurity" /t REG_DWORD /d 3 /f
:: Use application macro security level
reg add "HKCU\software\policies\microsoft\office\common\security" /v "automationsecurity" /t REG_DWORD /d 2 /f
:: Macros enabled (default)
reg add "HKCU\software\policies\microsoft\office\common\security" /v "automationsecurity" /t REG_DWORD /d 1 /f
PowerShell
# Common: create the key
New-Item -Path 'HKCU:\software\policies\microsoft\office\common\security' -Force | Out-Null

# Options (use only one)
# Disable macros by default
New-ItemProperty -Path 'HKCU:\software\policies\microsoft\office\common\security' -Name 'automationsecurity' -PropertyType DWord -Value 3 -Force | Out-Null
# Use application macro security level
New-ItemProperty -Path 'HKCU:\software\policies\microsoft\office\common\security' -Name 'automationsecurity' -PropertyType DWord -Value 2 -Force | Out-Null
# Macros enabled (default)
New-ItemProperty -Path 'HKCU:\software\policies\microsoft\office\common\security' -Name 'automationsecurity' -PropertyType DWord -Value 1 -Force | Out-Null