You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PowerShell 7转录功能失效,如何配置使其正常工作?

PowerShell 7 转录功能启用方案

传统Windows PowerShell的转录配置(注册表/组策略)不兼容PowerShell 7,需针对PowerShell 7单独配置,具体步骤如下:

方法一:手动配置注册表

PowerShell 7使用专属的注册表路径,而非原Windows PowerShell的路径,需创建以下注册表项:

1. 当前用户配置

打开PowerShell 7(当前用户配置无需管理员权限),执行以下命令:

# 创建PowerShellCore转录配置项
New-Item -Path "HKCU:\SOFTWARE\Policies\Microsoft\PowerShellCore\Transcription" -Force
# 启用转录功能
New-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\PowerShellCore\Transcription" -Name "EnableTranscripting" -Value 1 -PropertyType DWORD -Force
# 设置输出目录
New-ItemProperty -Path "HKCU:\SOFTWARE\Policies\Microsoft\PowerShellCore\Transcription" -Name "OutputDirectory" -Value "D:\logs" -PropertyType String -Force

2. 本地所有用户配置

需以管理员权限打开PowerShell 7,执行以下命令:

# 创建PowerShellCore转录配置项
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\PowerShellCore\Transcription" -Force
# 启用转录功能
New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\PowerShellCore\Transcription" -Name "EnableTranscripting" -Value 1 -PropertyType DWORD -Force
# 设置输出目录
New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\PowerShellCore\Transcription" -Name "OutputDirectory" -Value "D:\logs" -PropertyType String -Force

方法二:组策略配置(域/本地组策略)

  1. 下载并安装PowerShell Core的ADMX组策略模板,安装后组策略编辑器会新增PowerShell Core相关设置。
  2. 打开组策略编辑器,定位到:
    • 计算机配置:Computer Configuration > Administrative Templates > PowerShell Core > Turn on PowerShell Transcription
    • 用户配置:User Configuration > Administrative Templates > PowerShell Core > Turn on PowerShell Transcription
  3. 启用该策略,指定输出目录为D:\logs,保存后执行gpupdate /force刷新组策略。

验证生效

重启PowerShell 7,执行任意命令后,查看D:\logs目录下是否生成格式为PowerShell_transcript_<计算机名>_<时间戳>.txt的转录文件,若生成则配置生效。

内容的提问来源于stack exchange,提问作者TaihouKai

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.24 03:22:38