Skip to content

Instantly share code, notes, and snippets.

@pedroinfo
Last active September 12, 2025 17:49
Show Gist options
  • Select an option

  • Save pedroinfo/9a20c9eb50b24ea5b1e1d9eddb55b674 to your computer and use it in GitHub Desktop.

Select an option

Save pedroinfo/9a20c9eb50b24ea5b1e1d9eddb55b674 to your computer and use it in GitHub Desktop.
# Lista versões comuns do Office (16.0 = 2016/2019/365, 15.0 = 2013, 14.0 = 2010)
$officeVersions = @("16.0", "15.0", "14.0")
foreach ($version in $officeVersions) {
$path = "HKCU:\Software\Microsoft\Office\$version\Excel\Security"
if (Test-Path $path) {
Write-Output "Aplicando configuração para Excel versão $version..."
# Cria a chave se não existir
if (-not (Test-Path $path)) {
New-Item -Path $path -Force | Out-Null
}
# Libera macros (1 = habilitadas sem aviso)
Set-ItemProperty -Path $path -Name "VBAWarnings" -Value 1 -Force
# Desabilita bloqueio de macros vindas da Internet
Set-ItemProperty -Path $path -Name "BlockContentExecutionFromInternet" -Value 0 -Force
Write-Output "Macros liberadas e bloqueio da Internet desativado no Excel $version."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment