2011-04-14 29 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