Script causes ISE to crash

Welcome Forums General PowerShell Q&A Script causes ISE to crash

Viewing 2 reply threads
  • Author
    Posts
    • #280494
      Participant
      Topics: 1
      Replies: 1
      Points: 14
      Rank: Member

      I downloaded the Get-NetSession.ps1 script from the TechNet Script Center Gallery, (https://gallery.technet.microsoft.com/scriptcenter/View-Net-Sessions-locally-d6eb2ba0) but I needed the number of open files, so I substituted SESSION_INFO_10 for SESSION_INFO_1 and defined the two extra fields. It runs and returns the open files, but it crashes ISE right after that.

      I added code to get the user DisplayName, Telephone and Extension.  Also added code to format the SessionTime and IdleTime.  Still need to add code to display the OpenFiles correctly.

      Does anyone have any ideas why its crashing ISE?

      Running on a Windows 10 Enterprise Edition workstation.

      Thanks.

      • This topic was modified 1 month ago by grokkit. Reason: code formatting - please read the guide
    • #280509
      Senior Moderator
      Topics: 10
      Replies: 202
      Points: 1,101
      Helping Hand
      Rank: Community Hero

      PowerShell ISE is deprecated. Development of the ISE ended along with development of Windows PowerShell (v5.1), which was dropped in favor of the open-source PowerShell Core in 2017. No one is working on it; the problems with it won’t be fixed.

      Additionally, the PowerShell ISE console is not a ‘real’ console, but is effectively an emulation of a console running inside a Win32 application (it’s fake). There are significant execution differences between the ISE console and actual PowerShell, which are now amplified by the differences between Windows PowerShell and PowerShell Core, and three more years of development.

      So, ISE is not a valid test environment. You should test your scripts against the version of PowerShell that you have installed on your system, in a development environment. VSCode is the recommended development tool.

    • #280515
      Participant
      Topics: 1
      Replies: 1
      Points: 14
      Rank: Member

      I do have VSCode installed on my workstation, but since I started with ISE and don’t code as often as I wish, it’s my fallback.

      Let me try to run the script in VSCode.

      Also, like I said I don’t code often enough, I still haven’t figured out how to display the OpenFiles correctly.  It reports 37434 files open, when the user only has 2 files open.  Any help would be appreciated.

      Thanks,

       

Viewing 2 reply threads
  • You must be logged in to reply to this topic.