Turn on PowerShell Script Block Logging: wartość rejestru EnableScriptBlockLogging i 1 więcejUżytkownikHKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging

Brak oficjalnego tekstu w tym języku (wyświetlono oryginał angielski)

Identyfikator zasady
EnableScriptBlockLogging
Zakres
Konfiguracja komputera, Konfiguracja użytkownika
Obsługiwane w systemach
At least Microsoft Windows 7 or Windows Server 2008 family
Źródło
Administrative Templates (.admx) for Windows 11 2026 Update (26H2) (wersja 1.0)
Kategoria
Składniki systemu Windows › Windows PowerShell

Rejestr

EnableScriptBlockLogging

REG_DWORDUżytkownikKomputer
Wartość włączona
1
Wartość wyłączona
0
Zastosuj przez .reg · CMD · PowerShell
UżytkownikUstawienie dla każdego konta
.reg
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging]

; Opcje (użyj tylko jednej)
; Włączone
"EnableScriptBlockLogging"=dword:00000001
; Wyłączone
"EnableScriptBlockLogging"=dword:00000000
CMD
:: Opcje (użyj tylko jednej)

:: Włączone
reg add "HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockLogging" /t REG_DWORD /d 1 /f
:: Wyłączone
reg add "HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockLogging" /t REG_DWORD /d 0 /f
PowerShell
# Wspólne: utwórz klucz
New-Item -Path 'HKCU:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Force | Out-Null

# Opcje (użyj tylko jednej)
# Włączone
New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockLogging' -PropertyType DWord -Value 1 -Force | Out-Null
# Wyłączone
New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockLogging' -PropertyType DWord -Value 0 -Force | Out-Null
KomputerUstawienie dla całego komputera
.reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging]

; Opcje (użyj tylko jednej)
; Włączone
"EnableScriptBlockLogging"=dword:00000001
; Wyłączone
"EnableScriptBlockLogging"=dword:00000000
CMD
:: Opcje (użyj tylko jednej)

:: Włączone
reg add "HKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockLogging" /t REG_DWORD /d 1 /f
:: Wyłączone
reg add "HKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockLogging" /t REG_DWORD /d 0 /f
PowerShell
# Wspólne: utwórz klucz
New-Item -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Force | Out-Null

# Opcje (użyj tylko jednej)
# Włączone
New-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockLogging' -PropertyType DWord -Value 1 -Force | Out-Null
# Wyłączone
New-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockLogging' -PropertyType DWord -Value 0 -Force | Out-Null

EnableScriptBlockInvocationLogging

REG_DWORDUżytkownikKomputer
Zaznaczone
1
Niezaznaczone
0
Element
Log script block invocation start / stop events:
Typ wartości
REG_DWORD
Zastosuj przez .reg · CMD · PowerShell
UżytkownikUstawienie dla każdego konta
.reg
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging]

; Opcje (użyj tylko jednej)
; Zaznaczone
"EnableScriptBlockInvocationLogging"=dword:00000001
; Niezaznaczone
"EnableScriptBlockInvocationLogging"=dword:00000000
CMD
:: Opcje (użyj tylko jednej)

:: Zaznaczone
reg add "HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockInvocationLogging" /t REG_DWORD /d 1 /f
:: Niezaznaczone
reg add "HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockInvocationLogging" /t REG_DWORD /d 0 /f
PowerShell
# Wspólne: utwórz klucz
New-Item -Path 'HKCU:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Force | Out-Null

# Opcje (użyj tylko jednej)
# Zaznaczone
New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockInvocationLogging' -PropertyType DWord -Value 1 -Force | Out-Null
# Niezaznaczone
New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockInvocationLogging' -PropertyType DWord -Value 0 -Force | Out-Null
KomputerUstawienie dla całego komputera
.reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging]

; Opcje (użyj tylko jednej)
; Zaznaczone
"EnableScriptBlockInvocationLogging"=dword:00000001
; Niezaznaczone
"EnableScriptBlockInvocationLogging"=dword:00000000
CMD
:: Opcje (użyj tylko jednej)

:: Zaznaczone
reg add "HKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockInvocationLogging" /t REG_DWORD /d 1 /f
:: Niezaznaczone
reg add "HKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging" /v "EnableScriptBlockInvocationLogging" /t REG_DWORD /d 0 /f
PowerShell
# Wspólne: utwórz klucz
New-Item -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Force | Out-Null

# Opcje (użyj tylko jednej)
# Zaznaczone
New-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockInvocationLogging' -PropertyType DWord -Value 1 -Force | Out-Null
# Niezaznaczone
New-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name 'EnableScriptBlockInvocationLogging' -PropertyType DWord -Value 0 -Force | Out-Null