3

在我急切地想知道哪些变量是受保护的或常量时,我​​决定只看哪些可以被删除——假设上面提到的那些将被单独留下。我没有意识到这些变量的删除不仅限于本次 ISE 会议的范围,而且不仅是 PowerShell 全局的,而且是系统全局的。我希望有人可以帮助我让 ISE 再次工作。

我的愚蠢:

Remove-Variable *  

...导致报告了一堆错误,之后我执行时只剩下少数(10-15)个错误dir variable:。认为这没什么大不了的,并且重新启动 ISE 会使我恢复正常,我关闭了它——我无法再启动它了。

其他症状

从那以后我发现我已经丢失了环境变量之%windir%类的东西消失了——这是一个最有趣的转折,阻止你打开你的高级系统设置(找不到%windir%\system32\systempropertiesadvanced.exe)来设置你的 ENV 备份......(是的,我可以直接运行它)

更新:我发现了一个额外的影响/症状:Windows 报告说我在自动更新无法正常工作后可能没有正版 Windows。我没有意识到像一些 ENV vars 消失这样简单的事情会杀死它。人力资源管理系统。

那么 - 任何人都知道如何恢复或重新创建成功运行 ISE 所需的环境吗?

(是的,我已经尝试删除并重新添加该功能,并结合重新启动。)

4

2 回答 2

2

我刚才在 ISE 中做了 remove-Variable * 并且什么也没发生。我仍然可以打开 ISE 并照常工作。我还做了一个-WhatIf看看真正被删除的内容。

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 完全发挥作用。

于 2011-04-15T04:58:41.907 回答
0

感谢大家的帮助 - 这就是我所做的,虽然我不确定是否能在所有地方 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 提升的管理员权限作为其影响大于会话的根本原因。

于 2011-04-15T17:22:23.537 回答