2011-04-14 28 views
2

在我急于找出哪些变量是受保护的或常量时,我​​决定只是看看哪些可以被删除 - 假设上面提到的那些将被单独保留。我没有意识到的是,消除这些变量并不局限于本次ISE会议的范围 - 但不仅仅是Powershell全球 - 而是系统全球化。我希望有人能帮助我让ISE再次运作。Powershell ISE无法启动(愚蠢地)删除所有变量

我的愚蠢:

Remove-Variable * 

...导致了一堆错误及仅存的少数(10-15),当我执行dir variable:之后。认为这没什么大不了的,重新启动ISE会让我恢复正常,我关闭了它 - 它不会开始。

其他症状

因为我已经发现我已经失去的东西像环境变量%windir%都消失了 - 这在一个最有趣的转折,阻止您打开您的高级系统设置(找不到%windir%\system32\systempropertiesadvanced.exe)来设置你的ENV备份......(是的,我可以直接运行它)

更新:我发现了一个附加效果/症状:视窗报道,我可能不会有之后的正版Windows版本自动更新无法正常工作。我并没有意识到,像某些ENV变种一样简单的事情会杀死那些。人力资源管理。

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

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

+0

你一定做了别的事情。删除变量只会影响当前的PowerShell会话,除非您的设置非常不标准。 – Joey 2011-04-15 09:55:37

+0

我期望完全一样的东西 - 只有会话更改,但运行命令后,HKLM \ SYSTEM \ CurrentControlSet \ Control \ Session Manager \ Environment被减少到只有几个值。我现在注意到,ISE默认在这台机器上以管理员身份运行 - 而我的任何其他人都没有权限。好奇 - 我没有手动提升它。虽然我猜测这可能是区别,为什么它没有范围限制。谢谢您的帮助! – rand0m1 2011-04-15 17:19:42

回答

0

感谢所有的帮助 - 这就是我所做的,虽然我不确定我是否能够100%地回到我身边,这使我可以使用ISE,Hyper-V管理器并再次验证为真品。

我去到另一台服务器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的提升管理员权限作为其影响比会话更多的深层原因。

+0

我注意到在Win10系统上,这个参考%systemroot%的“C:\ Windows”部分。 – music2myear 2017-05-25 17:58:41

2

我的确在ISE删除变量*刚才并没有什么happend。我仍然可以打开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完全发挥作用。

+0

正如我上面评论的那样,我猜测ISE的提升管理员权限与它有关 - 因为我认为和你一样!谢谢您的帮助! – rand0m1 2011-04-15 17:20:00