Ativar Registro de Bloco de Script do PowerShell: valor do Registro EnableScriptBlockLogging e mais 1ComputadorHKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging
- ID da política
- EnableScriptBlockLogging
- Escopo
- Configuração do Computador, Configuração do Usuário
- Compatível com
- Pelo menos o Microsoft Windows 7 ou a família Windows Server 2008
- Fonte
- Administrative Templates (.admx) for Windows 11 2026 Update (26H2) (versão 1.0)
- Categoria
- Componentes do Windows › Windows PowerShell
Registro
EnableScriptBlockLogging
REG_DWORDComputadorUsuário…\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLoggingHKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging Chave atual
HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging
HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging
- Valor habilitado
- 1
- Valor desabilitado
- 0
Aplicar com .reg · CMD · PowerShell
ComputadorConfiguração global do computador
.reg
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging] ; Opções (use apenas uma) ; Habilitada "EnableScriptBlockLogging"=dword:00000001 ; Desabilitada "EnableScriptBlockLogging"=dword:00000000
CMD
:: Opções (use apenas uma) :: Habilitada reg add "HKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockLogging" /t REG_DWORD /d 1 /f :: Desabilitada reg add "HKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockLogging" /t REG_DWORD /d 0 /f
PowerShell
# Comum: criar a chave New-Item -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Force | Out-Null # Opções (use apenas uma) # Habilitada New-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockLogging' -PropertyType DWord -Value 1 -Force | Out-Null # Desabilitada New-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockLogging' -PropertyType DWord -Value 0 -Force | Out-Null
UsuárioConfiguração por conta
.reg
Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging] ; Opções (use apenas uma) ; Habilitada "EnableScriptBlockLogging"=dword:00000001 ; Desabilitada "EnableScriptBlockLogging"=dword:00000000
CMD
:: Opções (use apenas uma) :: Habilitada reg add "HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockLogging" /t REG_DWORD /d 1 /f :: Desabilitada reg add "HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockLogging" /t REG_DWORD /d 0 /f
PowerShell
# Comum: criar a chave New-Item -Path 'HKCU:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Force | Out-Null # Opções (use apenas uma) # Habilitada New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockLogging' -PropertyType DWord -Value 1 -Force | Out-Null # Desabilitada New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockLogging' -PropertyType DWord -Value 0 -Force | Out-Null
EnableScriptBlockInvocationLogging
REG_DWORDComputadorUsuário…\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLoggingHKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging Chave atual
HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging
HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging
- Marcado
- 1
- Desmarcado
- 0
- Elemento
- Registrar eventos de início/término de invocação de bloco de script:
- Tipo de valor
- REG_DWORD
Aplicar com .reg · CMD · PowerShell
ComputadorConfiguração global do computador
.reg
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging] ; Opções (use apenas uma) ; Marcado "EnableScriptBlockInvocationLogging"=dword:00000001 ; Desmarcado "EnableScriptBlockInvocationLogging"=dword:00000000
CMD
:: Opções (use apenas uma) :: Marcado reg add "HKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockInvocationLogging" /t REG_DWORD /d 1 /f :: Desmarcado reg add "HKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockInvocationLogging" /t REG_DWORD /d 0 /f
PowerShell
# Comum: criar a chave New-Item -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Force | Out-Null # Opções (use apenas uma) # Marcado New-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockInvocationLogging' -PropertyType DWord -Value 1 -Force | Out-Null # Desmarcado New-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockInvocationLogging' -PropertyType DWord -Value 0 -Force | Out-Null
UsuárioConfiguração por conta
.reg
Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging] ; Opções (use apenas uma) ; Marcado "EnableScriptBlockInvocationLogging"=dword:00000001 ; Desmarcado "EnableScriptBlockInvocationLogging"=dword:00000000
CMD
:: Opções (use apenas uma) :: Marcado reg add "HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockInvocationLogging" /t REG_DWORD /d 1 /f :: Desmarcado reg add "HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockInvocationLogging" /t REG_DWORD /d 0 /f
PowerShell
# Comum: criar a chave New-Item -Path 'HKCU:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Force | Out-Null # Opções (use apenas uma) # Marcado New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockInvocationLogging' -PropertyType DWord -Value 1 -Force | Out-Null # Desmarcado New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockInvocationLogging' -PropertyType DWord -Value 0 -Force | Out-Null