Turn on PowerShell Transcription
Activer la transcription PowerShell
Explanation
This policy setting lets you capture the input and output of Windows PowerShell commands into text-based transcripts.
If you enable this policy setting, Windows PowerShell will enable transcripting for Windows PowerShell, the Windows PowerShell ISE, and any other
applications that leverage the Windows PowerShell engine. By default, Windows PowerShell will record transcript output to each users' My Documents
directory, with a file name that includes 'PowerShell_transcript', along with the computer name and time started. Enabling this policy is equivalent
to calling the Start-Transcript cmdlet on each Windows PowerShell session.
If you disable this policy setting, transcripting of PowerShell-based applications is disabled by default, although transcripting can still be enabled
through the Start-Transcript cmdlet.
If you use the OutputDirectory setting to enable transcript logging to a shared location, be sure to limit access to that directory to prevent users
from viewing the transcripts of other users or computers.
Note: This policy setting exists under both Computer Configuration and User Configuration in the Group Policy Editor. The Computer Configuration policy setting takes precedence over the User Configuration policy setting.
Ce paramètre de stratégie vous permet de capturer l'entrée et la sortie de commandes Windows PowerShell dans le texte de transcription.
Si vous activez ce paramètre de stratégie, Windows PowerShell activera la transcription pour Windows PowerShell, Windows PowerShell ISE et toute autre
application qui s'appuie sur le moteur Windows PowerShell. Par défaut, Windows PowerShell enregistrera les sorties de transcription dans le répertoire « Mes documents » de chaque utilisateur
avec un nom de fichier comprenant « PowerShell_transcript », ainsi que l'heure de début et le nom de l'ordinateur. L'activation de cette stratégie revient
à appeler l'applet de commande Start-Transcript sur chaque session Windows PowerShell.
Si vous désactivez ce paramètre de stratégie, la transcription des applications basées sur PowerShell est désactivée par défaut, même si elle peut toujours être activée
par le biais de l'applet de commande Start-Transcript.
Si vous utilisez le paramètre OutputDirectory pour activer la journalisation des transcriptions dans un emplacement partagé, veillez à limiter l'accès à ce répertoire pour empêcher les utilisateurs
de voir les transcriptions d'autres utilisateurs ou ordinateurs.
Remarque : ce paramètre de stratégie se trouve sous Configuration ordinateur et Configuration utilisateur dans l'éditeur de stratégie de groupe. Le paramètre de stratégie de Configuration ordinateur est prioritaire sur le paramètre de stratégie de Configuration utilisateur.
Use cases
Captures the input and output of all PowerShell sessions to text files, as if Start-Transcript ran in every session. Useful for auditing admin sessions on sensitive servers.
By default transcripts go to each user's Documents folder: set a central output directory and restrict access to it, otherwise users could read other people's transcripts.
Microsoft source: about_Group_Policy_Settings
Registry
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\PowerShell\TranscriptionHKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\PowerShell\Transcription- Value name
EnableTranscripting
| State | Value written |
|---|---|
| Enabled | REG_DWORD = 1 |
| Disabled | REG_DWORD = 0 |
PowerShell
PowerShell commands that write to the registry what the policy would write. Values in angle brackets (<…>) must be replaced.
Writing directly to the registry bypasses Group Policy: if a GPO manages this value, it will be rewritten at the next gpupdate; otherwise the value stays in place (the "tattooing" effect). Prefer a GPO or, locally, LGPO.exe. Run PowerShell as administrator for HKLM. Some policies need a restart or gpupdate /force.
Computer (HKLM)
Enable
# Enable: PowerShellExecutionPolicy/EnableTranscripting
$k = 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\Transcription'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'EnableTranscripting' -Value 1 -Type DWord
# Transcript output directory
Set-ItemProperty -Path $k -Name 'OutputDirectory' -Value '<value>' -Type String
# Include invocation headers
# value not defined in the ADMX (the GPO editor usually writes 1/0)
# 1 = checked, 0 = unchecked; default state taken from the ADML
Set-ItemProperty -Path $k -Name 'EnableInvocationHeader' -Value 1 -Type DWordDisable
# Disable: PowerShellExecutionPolicy/EnableTranscripting
$k = 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\Transcription'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'EnableTranscripting' -Value 0 -Type DWordRevert to "Not configured"
# Revert to "Not configured": PowerShellExecutionPolicy/EnableTranscripting
$k = 'HKLM:\Software\Policies\Microsoft\Windows\PowerShell\Transcription'
Remove-ItemProperty -Path $k -Name 'EnableTranscripting' -ErrorAction SilentlyContinue
Remove-ItemProperty -Path $k -Name 'OutputDirectory' -ErrorAction SilentlyContinue
Remove-ItemProperty -Path $k -Name 'EnableInvocationHeader' -ErrorAction SilentlyContinueUser (HKCU)
Enable
Disable
Revert to "Not configured"
Options (2)
| Label | Control | Registry value | REG type | Constraints / details |
|---|---|---|---|---|
| Transcript output directoryRépertoire de sortie de transcriptionOutputDirectory | Text boxtext | OutputDirectory | REG_SZ | |
| Include invocation headers:Inclure les en-têtes de l'appel :EnableInvocationHeader | Check boxboolean | EnableInvocationHeader | REG_DWORD | Checked: implicit: 1Unchecked: implicit: 0 |