Skip to content

Instantly share code, notes, and snippets.

@kilasuit
Last active February 11, 2023 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kilasuit/e7c276ca67929ae54369f726877dab08 to your computer and use it in GitHub Desktop.
Save kilasuit/e7c276ca67929ae54369f726877dab08 to your computer and use it in GitHub Desktop.
Enable-OverTheShoulderPSTranscription is a function that you can run to set the registry keys that Force
function Enable-OverTheShoulderPSTranscription {
$basePath = "HKLM:\Software\Policies\Microsoft\PowerShellCore\Transcription"
if(-not (Test-Path $basePath)) { $null = New-Item $basePath -Force }
Set-ItemProperty $basePath -Name EnableTranscripting -Value 1
Set-ItemProperty $basePath -Name OutputDirectory -Value "$env:USERPROFILE\OneDrive\PSTranscripts\$env:COMPUTERNAME\PSCore\"
Set-ItemProperty $basePath -Name EnableInvocationHeader -Value 1
$basePath = "HKLM:\Software\Policies\Microsoft\Windows\PowerShell\Transcription"
if(-not (Test-Path $basePath)) { $null = New-Item $basePath -Force }
Set-ItemProperty $basePath -Name EnableTranscripting -Value 1
Set-ItemProperty $basePath -Name OutputDirectory -Value "$env:USERPROFILE\OneDrive\PSTranscripts\$env:COMPUTERNAME\"
Set-ItemProperty $basePath -Name EnableInvocationHeader -Value 1
}
{"Microsoft.PowerShell:ExecutionPolicy":"RemoteSigned",
"PowerShellPolicies": {
"Transcription": {
"EnableTranscripting": true,
"EnableInvocationHeader": true,
"OutputDirectory": "C:\\tmp\\"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment