Complete the code to enable script block logging in PowerShell.
Set-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name [1] -Value 1
The registry key EnableScriptBlockLogging enables script block logging in PowerShell.
Complete the command to check if script block logging is enabled.
Get-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name [1]
The property EnableScriptBlockLogging indicates if script block logging is enabled.
Fix the error in the command to enable script block logging.
Set-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name [1] -Value 1
The value must be 1 (integer) to enable logging, not the string 'true'. The property name is EnableScriptBlockLogging.
Fill both blanks to create a script block logging policy and enable it.
New-Item -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell' -Name [1] -Force; Set-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\[2]' -Name EnableScriptBlockLogging -Value 1
The registry key ScriptBlockLogging must exist under PowerShell policies to set the EnableScriptBlockLogging property.
Fill all three blanks to enable script block logging and start PowerShell transcription.
Set-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging' -Name [1] -Value 1; Start-Transcript -Path [2]; Write-Output [3]
Enable script block logging by setting EnableScriptBlockLogging to 1, start transcription to a log file, and output a confirmation message.