Search notes:

Registry: HKEY_CURRENT_USER\Software\Microsoft\Office\{version}\{name}\Security\Trusted Documents\TrustRecords

The registry key HKEY_CURRENT_USER\Software\Microsoft\Office\{version}\{name}\Security\Trusted Documents\TrustRecords stores values whose names corespond to file paths of Office documents and whose values are arrays of 24 bytes (REG_BINARY):
In this registry key, {version} corresponds to a two-digit Office version number, {name} is one of Access, Excel, PowerPoint or Word
Note: the value-names need to have a forward slash in their path names. A references to c:/users/username needs to be replaced with %USERPROFILE%.

Adding a document to this registry key

The following PowerShell script adds a document to this registry key:
set-strictMode -version latest

if ($args.length -ne 2) {
   write-host "add-document [Word|Excel|...] P:\ath\to\document"
   return
}

$application_name = $args[0]
$document_name    = $args[1]

if ($application_name -notIn 'Access', 'Excel', 'PowerPoint', 'Word') {
   write-host 'First parameter must be one of Access, Excel, PowerPoint or Word'
   return
}

$regKey = "hklm:\Software\Classes\${application_name}.application\curVer"

if (! (test-path $regKey)) {
   write-host "Registry key $regKey was not found"
   return
}

$application_version = (get-item $regKey).getValue('')  -replace '.*\.(\d+)', '$1'

set-itemProperty  `
  "hkcu:\Software\Microsoft\Office\$application_version.0\$application_name\Security\Trusted Documents\TrustRecords" `
  -type binary         `
  -name $document_name `
  -force               `
  -value  0x06, 0x51, 0x45, 0x6f, 0x65, 0x3d, 0xd6, 0x01,
          0x00, 0xd0, 0x88, 0xc3, 0x10, 0x00, 0x00, 0x00,
          0xd2, 0xc5, 0x94, 0x01,
          0xff, 0xff, 0xff, 0x7f
Github repository about-Windows-Registry, path: /HKEY_CURRENT_USER/Software/Microsoft/Office/application_version/application_name/Security/Trusted Documents/TrustRecords/add-document.ps1
When executed, the script needs to be given two arguments: the Office-application-name (Word, Excel…) and the document name (note the forward slashes).
PS … > add-document.ps1 Word P:/ath/to/document.docm

See also

Trusted Locations
HKEY_CURRENT_USER\Software\Microsoft\Office\{version}\Word\Security\Trusted Documents\TrustRecords

Index