Attiva registrazione blocco script di PowerShell: valore del Registro di sistema EnableScriptBlockLogging e altri 1UtenteHKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging
- ID criterio
- EnableScriptBlockLogging
- Ambito
- Configurazione computer, Configurazione utente
- Supportato in
- Almeno Windows 7 o famiglia Windows Server 2008
- Origine
- Administrative Templates (.admx) for Windows 11 2026 Update (26H2) (versione 1.0)
- Categoria
- Componenti di Windows › Windows PowerShell
Registro
EnableScriptBlockLogging
REG_DWORDUtenteComputer…\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLoggingHKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging Chiave corrente
HKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging
HKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging
- Valore abilitato
- 1
- Valore disabilitato
- 0
Applica con .reg · CMD · PowerShell
UtenteImpostazione per account
.reg
Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging] ; Opzioni (usarne solo una) ; Abilitato "EnableScriptBlockLogging"=dword:00000001 ; Disabilitato "EnableScriptBlockLogging"=dword:00000000
CMD
:: Opzioni (usarne solo una) :: Abilitato reg add "HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockLogging" /t REG_DWORD /d 1 /f :: Disabilitato reg add "HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockLogging" /t REG_DWORD /d 0 /f
PowerShell
# Comune: crea la chiave New-Item -Path 'HKCU:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Force | Out-Null # Opzioni (usarne solo una) # Abilitato New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockLogging' -PropertyType DWord -Value 1 -Force | Out-Null # Disabilitato New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockLogging' -PropertyType DWord -Value 0 -Force | Out-Null
ComputerImpostazione globale del computer
.reg
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging] ; Opzioni (usarne solo una) ; Abilitato "EnableScriptBlockLogging"=dword:00000001 ; Disabilitato "EnableScriptBlockLogging"=dword:00000000
CMD
:: Opzioni (usarne solo una) :: Abilitato reg add "HKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockLogging" /t REG_DWORD /d 1 /f :: Disabilitato reg add "HKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockLogging" /t REG_DWORD /d 0 /f
PowerShell
# Comune: crea la chiave New-Item -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Force | Out-Null # Opzioni (usarne solo una) # Abilitato New-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockLogging' -PropertyType DWord -Value 1 -Force | Out-Null # Disabilitato New-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockLogging' -PropertyType DWord -Value 0 -Force | Out-Null
EnableScriptBlockInvocationLogging
REG_DWORDUtenteComputer…\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLoggingHKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging Chiave corrente
HKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging
HKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging
- Selezionato
- 1
- Non selezionato
- 0
- Elemento
- Registra eventi di avvio/interruzione chiamata di blocco di script:
- Tipo di valore
- REG_DWORD
Applica con .reg · CMD · PowerShell
UtenteImpostazione per account
.reg
Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging] ; Opzioni (usarne solo una) ; Selezionato "EnableScriptBlockInvocationLogging"=dword:00000001 ; Non selezionato "EnableScriptBlockInvocationLogging"=dword:00000000
CMD
:: Opzioni (usarne solo una) :: Selezionato reg add "HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockInvocationLogging" /t REG_DWORD /d 1 /f :: Non selezionato reg add "HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockInvocationLogging" /t REG_DWORD /d 0 /f
PowerShell
# Comune: crea la chiave New-Item -Path 'HKCU:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Force | Out-Null # Opzioni (usarne solo una) # Selezionato New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockInvocationLogging' -PropertyType DWord -Value 1 -Force | Out-Null # Non selezionato New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockInvocationLogging' -PropertyType DWord -Value 0 -Force | Out-Null
ComputerImpostazione globale del computer
.reg
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging] ; Opzioni (usarne solo una) ; Selezionato "EnableScriptBlockInvocationLogging"=dword:00000001 ; Non selezionato "EnableScriptBlockInvocationLogging"=dword:00000000
CMD
:: Opzioni (usarne solo una) :: Selezionato reg add "HKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockInvocationLogging" /t REG_DWORD /d 1 /f :: Non selezionato reg add "HKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockInvocationLogging" /t REG_DWORD /d 0 /f
PowerShell
# Comune: crea la chiave New-Item -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Force | Out-Null # Opzioni (usarne solo una) # Selezionato New-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockInvocationLogging' -PropertyType DWord -Value 1 -Force | Out-Null # Non selezionato New-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockInvocationLogging' -PropertyType DWord -Value 0 -Force | Out-Null