gpt4 book ai didi

windows - Powershell 立即关闭

转载 作者:行者123 更新时间:2023-12-03 11:14:27 24 4
gpt4 key购买 nike

我查看了所有的互联网,但找不到任何适用于这种情况的信息。
Powershell 启动后立即关闭。当我在命令提示符中运行它时,我得到以下信息:

Windows PowerShell terminated with the following error:
Unable to cast object of type 'System.String' to type 'System.String[]'.
我检查了以下文件夹,但不存在任何配置文件:

c:\users\me\appdata\microsoft\windows\powershell

c:\windows\system32\windowspowershell\v1.0\

c:\windows\systwow64\windowspowershell\v1.0\


我尝试使用以下命令运行但没有运气: powershell -noexit powershell -noprofile我已经运行了以下命令并且没有运气: sfc.exe /scannow DISM.exe /Online /Cleanup-image /Restorehealth我也去了控制面板->卸载程序->然后打开或关闭Windows功能,
删除Powershell,重新启动,然后重新安装。
完成所有这些步骤后,我仍然无法运行 Powershell。 ISE 也不起作用。

最佳答案

这可能与 Powershell 日志记录设置有关。在使用 ModuleNames 的错误路径实现 Powershell 模块日志记录后,我遇到了完全相同的问题.
检查 HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ModuleLogging 中设置的值
就我而言,我错误地添加了 ModuleNames 的值。设置为 * - 没有意识到它应该是一个名为 ModuleNames 的 KEY - 导致错误

Windows PowerShell terminated with the following error:
Unable to cast object of type 'System.String' to type 'System.String[]'.

通过添加正确的路径 HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ModuleLogging\ModuleNames\REG_SZ名为 * 的值并且值为 *我让 Powershell 再次工作。
Registry image
请注意,如果此设置来自域中的 GPO(组策略对象),则需要在此处而不是在注册表中进行修复。否则,GPO 将在下次应用时覆盖本地设置。

关于windows - Powershell 立即关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60193358/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com