Powershell ISE无法启动(愚蠢地)删除所有变量

| 我急切地想找出哪些变量是受保护的或常量,我决定只看一下可以删除哪些变量-假设上面提到的那些变量将不予处理。我没有意识到的是,删除这些变量将不仅限于ISE本届会议的范围-不仅是PowerShell全局的-而是系统全局的。我希望有人可以帮助我使ISE重新工作。 我的愚蠢:
Remove-Variable *  
...导致了一系列错误报告,之后我执行
dir variable:
时只剩下极少数(10-15)。认为这没什么大不了的,并且重启ISE可以使我恢复正常,所以我关闭了它-并且我无法启动它了。 其他症状 从那以后,我发现我丢失了诸如环境变量
%windir%
之类的东西-这是最有趣的转折,它阻止您打开高级系统设置(找不到
%windir%\\system32\\systempropertiesadvanced.exe
)来设置ENV备份。 ..(是的,我可以直接运行它) 更新:我发现了其他效果/症状:Windows报告说自动更新无法正常工作后,我可能没有Windows的正版版本。我还没有意识到,像某些ENV变量那样简单的事情会杀死它。嗯 那么-谁知道如何还原或重新创建成功运行ISE所需的环境? (是的,我尝试过删除并重新添加该功能,并重新启动。)     
已邀请:
我刚才在ISE中做了remove-Variable *,什么也没发生。我仍然可以打开ISE并照常工作。我还花了4英镑来看看真正删除的内容。
PS H:\\> Remove-Variable * -WhatIf
What if: Performing operation \"Remove Variable\" on Target \"Name: null\".
What if: Performing operation \"Remove Variable\" on Target \"Name: false\".
What if: Performing operation \"Remove Variable\" on Target \"Name: true\".
What if: Performing operation \"Remove Variable\" on Target \"Name: MaximumErrorCount\".
What if: Performing operation \"Remove Variable\" on Target \"Name: MaximumVariableCount\".
What if: Performing operation \"Remove Variable\" on Target \"Name: MaximumFunctionCount\".
What if: Performing operation \"Remove Variable\" on Target \"Name: MaximumAliasCount\".
What if: Performing operation \"Remove Variable\" on Target \"Name: MaximumDriveCount\".
What if: Performing operation \"Remove Variable\" on Target \"Name: Error\".
What if: Performing operation \"Remove Variable\" on Target \"Name: PWD\".
What if: Performing operation \"Remove Variable\" on Target \"Name: ?\".
What if: Performing operation \"Remove Variable\" on Target \"Name: MaximumHistoryCount\".
What if: Performing operation \"Remove Variable\" on Target \"Name: Host\".
What if: Performing operation \"Remove Variable\" on Target \"Name: HOME\".
What if: Performing operation \"Remove Variable\" on Target \"Name: ExecutionContext\".
What if: Performing operation \"Remove Variable\" on Target \"Name: PSVersionTable\".
What if: Performing operation \"Remove Variable\" on Target \"Name: PID\".
What if: Performing operation \"Remove Variable\" on Target \"Name: PSCulture\".
What if: Performing operation \"Remove Variable\" on Target \"Name: PSUICulture\".
What if: Performing operation \"Remove Variable\" on Target \"Name: ShellId\".
What if: Performing operation \"Remove Variable\" on Target \"Name: PSHOME\".
What if: Performing operation \"Remove Variable\" on Target \"Name: ConsoleFileName\".
What if: Performing operation \"Remove Variable\" on Target \"Name: $\".
What if: Performing operation \"Remove Variable\" on Target \"Name: ^\".
What if: Performing operation \"Remove Variable\" on Target \"Name: StackTrace\".
What if: Performing operation \"Remove Variable\" on Target \"Name: OutputEncoding\".
What if: Performing operation \"Remove Variable\" on Target \"Name: ConfirmPreference\".
What if: Performing operation \"Remove Variable\" on Target \"Name: DebugPreference\".
What if: Performing operation \"Remove Variable\" on Target \"Name: ErrorActionPreference\".
What if: Performing operation \"Remove Variable\" on Target \"Name: ProgressPreference\".
What if: Performing operation \"Remove Variable\" on Target \"Name: VerbosePreference\".
What if: Performing operation \"Remove Variable\" on Target \"Name: WarningPreference\".
What if: Performing operation \"Remove Variable\" on Target \"Name: ErrorView\".
What if: Performing operation \"Remove Variable\" on Target \"Name: NestedPromptLevel\".
What if: Performing operation \"Remove Variable\" on Target \"Name: ReportErrorShowExceptionClass\".
What if: Performing operation \"Remove Variable\" on Target \"Name: ReportErrorShowInnerException\".
What if: Performing operation \"Remove Variable\" on Target \"Name: ReportErrorShowSource\".
What if: Performing operation \"Remove Variable\" on Target \"Name: ReportErrorShowStackTrace\".
What if: Performing operation \"Remove Variable\" on Target \"Name: WhatIfPreference\".
What if: Performing operation \"Remove Variable\" on Target \"Name: FormatEnumerationLimit\".
What if: Performing operation \"Remove Variable\" on Target \"Name: PSEmailServer\".
What if: Performing operation \"Remove Variable\" on Target \"Name: PSSessionOption\".
What if: Performing operation \"Remove Variable\" on Target \"Name: PSSessionConfigurationName\".
What if: Performing operation \"Remove Variable\" on Target \"Name: PSSessionApplicationName\".
What if: Performing operation \"Remove Variable\" on Target \"Name: psUnsupportedConsoleApplications\".
What if: Performing operation \"Remove Variable\" on Target \"Name: PSBoundParameters\".
What if: Performing operation \"Remove Variable\" on Target \"Name: args\".
What if: Performing operation \"Remove Variable\" on Target \"Name: input\".
What if: Performing operation \"Remove Variable\" on Target \"Name: MyInvocation\".
What if: Performing operation \"Remove Variable\" on Target \"Name: _\".
What if: Performing operation \"Remove Variable\" on Target \"Name: psLocalHelp\".
What if: Performing operation \"Remove Variable\" on Target \"Name: psOnlineHelp\".
What if: Performing operation \"Remove Variable\" on Target \"Name: psISE\".
What if: Performing operation \"Remove Variable\" on Target \"Name: profile\".
注意该列表中确实包含了所有内容。顺便说一句,这些只是ISE运行空间中的变量。我不确定删除这些变量将如何阻止ISE完全起作用。     
谢谢大家的帮助-这是我所做的,虽然我不确定到哪里都能使我100%回来,但它使我能够使用ISE,Hyper-V管理器并再次验证为正品。 我转到另一个Server 2008 R2框,比较了密钥并手动编辑了注册表,并将这些值添加回损坏的计算机:
HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment
  Path=C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;
  PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
  PSModulePath=C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules\\
  TEMP=C:\\Windows\\TEMP
  TMP=C:\\Windows\\TEMP
  windir=C:\\Windows
我倾向于提高ISE的管理员特权,因为它比会话影响更大的根本原因。     

要回复问题请先登录注册