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.
My foolishness:
Remove-Variable *
...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 IS开发者_运维知识库E would restore me to normality, I closed it -- and I cannot start it anymore.
Additional Symptoms
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)
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.
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.)
I did remove-Variable * in ISE just now and nothing happend. I can still open ISE and work as usual. I also did a -WhatIf
to see what really gets removed.
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".
Noting really scray in that list. BTW, these are just variables in the ISE runspace. I am not sure how removing these variables would prevent ISE from functioning altogether.
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.
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
I'm leaning towards the elevated Administrator privilege of the ISE as the underlying reason it affected more than the session.
精彩评论