Powershell ISE 在(愚蠢地)删除所有变量后无法启动 [英] Powershell ISE cannot start after (foolishly) deleting all variables

查看:43
本文介绍了Powershell ISE 在(愚蠢地)删除所有变量后无法启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

In my eagerness to find out what variables were protected or constants, I decided to just see what ones could be removed - assuming those mentioned above would be left alone. What I didn't realize is the removal of those variables would not be limited to the scope of this session of the ISE - but was not only PowerShell global - but system global. I'm hoping that someone can help me get the ISE working again.

我的愚蠢:

Remove-Variable *  

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

...resulted in a bunch of errors reported and only a handful (10-15) remaining when I executed dir variable: afterward. Thinking it was no big deal and that a restart of the ISE would restore me to normality, I closed it -- and I cannot start it anymore.

其他症状

此后我发现我丢失了诸如环境变量 %windir% 之类的东西 - 最有趣的是,这会阻止您打开高级系统设置(找不到%windir%\system32\systempropertiesadvanced.exe) 来设置你的 ENV 备份...(是的,我可以直接运行它)

I've since found that I've lost things like environment variables %windir% are gone - which in a most interesting twist, prevents you from opening your Advanced system settings (can't find %windir%\system32\systempropertiesadvanced.exe) to set your ENV back up... (Yes, I can run it directly)

更新:我发现了一个额外的影响/症状:在自动更新无法正常工作后,Windows 报告我可能没有正版的 Windows.我没有意识到像一些 ENV 变量消失这样简单的事情会杀死它.嗯.

Update: I found an additional effect/symptom: Windows reported that I may not have a genuine version of Windows after the auto-update was not able to work correctly. I hadn't realized that something as simple as some ENV vars being gone would kill that. Hrm.

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

So - anyone knows how to restore or re-create the environment needed to successfully run the ISE?

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

(And yes, I've tried removing and re-adding the Feature, combined with reboots.)

推荐答案

感谢大家的帮助 - 这就是我所做的,虽然我不确定让我在任何地方都 100% 回来,但允许我使用 ISE,Hyper-V 管理器并再次验证为正版.

Thanks all for the assist - here's what I did, which while I'm not sure got me back 100% everywhere, has allowed me to use the ISE, Hyper-V Manager and validate as genuine again.

我去了另一个 Server 2008 R2 机器,比较了密钥并手动编辑了注册表并将这些值添加回损坏的机器:

I went to another Server 2008 R2 box, compared the key and manually edited the registry and added these values back to the broken machine:

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 提升的管理员权限作为其影响比会话更大的根本原因.

I'm leaning towards the elevated Administrator privilege of the ISE as the underlying reason it affected more than the session.

这篇关于Powershell ISE 在(愚蠢地)删除所有变量后无法启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆