启动时未处理的 Powershell 错误

启动时未处理的 Powershell 错误

今天晚上尝试启动 powershell x64 时,我随机开始收到未处理的异常。几个小时前我让电脑进入睡眠状态之前,它运行良好。

Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.SEHException: External component has thrown an exception.
  at System.Runtime.CompilerServices.RuntimeHelpers.PrepareContractedDelegate(Delegate d)
  at System.AppDomain.add_UnhandledException(UnhandledExceptionEventHandler value)
  at System.Management.Automation.WindowsErrorReporting.RegisterWindowsErrorReporting(Boolean unattendedServer)
  at Microsoft.PowerShell.UnmanagedPSEntry.Start(String consoleFilePath, String[] args)
  --- End of inner exception stack trace ---
  at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
  at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
  at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

Unhandled Exception: System.TypeInitializationException: The type initializer for 'System.Management.Automation.Utils' threw an exception. ---> System.Runtime.InteropServices.SEHException: External component has thrown an exception.
  at System.Management.Automation.Utils..cctor()
  --- End of inner exception stack trace ---
  at System.Management.Automation.Runspaces.EarlyStartup.<>c.<Init>b__0_0()
  at System.Threading.Tasks.Task.Execute()
  at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
  at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
  at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
  at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
  at System.Threading.ThreadPoolWorkQueue.Dispatch()

我执行了 sfc /scannow,没有发现任何问题。多次重启后问题仍然存在。我尝试创建一个新的 Windows 用户,但新用户的问题仍然存在。

知道可能是什么原因造成的吗或我该如何进行修复?

答案1

我卸载了 Windows 更新 KB4016871,一切又开始正常工作。

相关内容