Kae Travis

PowerShell ISE Crashes When Loading

I’ve recently come across an issue where PowerShell ISE crashes when loading.

Bizarrely, it only failed to launch when using ‘RunAs’ to elevate it as a different (admin) user. It worked fine if i ran it as the logged in user. Which told me it was some kind of profile-related issue.

There was an entry in the event viewer but it didn’t really tell us much. It looked something like this:

Problem signature:
P1: powershell_ise.exe
P2: 10.0.19041.1682
P3: System.IO.FileFormatException
P4: System.Reflection.TargetInvocation
P5: Windows.PowerShell.GuiExe.Internal.GPowerShell.Main
P6: System.RuntimeMethodHandle.InvokeMethod
P7: unknown
P8:
P9:
P10:

I immediately turned to Procmon and temporarily renamed the following locations:

C:\Users\kt04ag\AppData\Local\Microsoft_Corporation\PowerShell_ISE.exe_StrongName_lw2v2vm3wmtzzpebq33gybmeoxukb04w

and the SID of the user i was running it as in:

C:\Users\[logged-in-user]\AppData\Local\Microsoft\Windows\PowerShell\ISE\[runas-user-sid]

But it still didn’t work.

I tried running PowerShell ISE without a profile:

PowerShell_Ise -NoProfile

but it still didn’t launch. I was running out of ideas.

I decided that since I only used my admin account to elevate different applications, I would just purge the Windows profile! So I did the following.

  1. Restarted my machine to ensure nothing was running as the admin account that I was about to delete the profile of.
  2. Ran sysdm.cpl as ANOTHER admin user (i.e, not the one i was going to delete the profile of!)
  3. Go to the Advanced tab.
  4. Under ‘User Profiles’ click ‘Settings’.
  5. Highlight the admin profile you want to delete, and click ‘Delete’. (If the delete button is disabled you are probably running something as that account.)

And voila! I ran Powershell ISE again as my admin account and it worked!

PowerShell ISE Crashes When Loading
PowerShell ISE Crashes When Loading

Leave a Reply