Last active
          March 21, 2025 02:11 
        
      - 
      
- 
        Save perXautomatik/c4b67d298dc087dd87da3ccaa85a9a9b to your computer and use it in GitHub Desktop. 
    Using PowerShell 7 in the Windows PowerShell ISE
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Clear() | |
| $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add("Switch to PowerShell 7", { | |
| function New-OutOfProcRunspace { | |
| param($ProcessId) | |
| $ci = New-Object -TypeName System.Management.Automation.Runspaces.NamedPipeConnectionInfo -ArgumentList @($ProcessId) | |
| $tt = [System.Management.Automation.Runspaces.TypeTable]::LoadDefaultTypeFiles() | |
| $Runspace = [System.Management.Automation.Runspaces.RunspaceFactory]::CreateRunspace($ci, $Host, $tt) | |
| $Runspace.Open() | |
| $Runspace | |
| } | |
| $PowerShell = Start-Process PWSH -ArgumentList @("-NoExit") -PassThru -WindowStyle Hidden | |
| $Runspace = New-OutOfProcRunspace -ProcessId $PowerShell.Id | |
| $Host.PushRunspace($Runspace) | |
| }, "ALT+F5") | Out-Null | |
| $psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add("Switch to Windows PowerShell", { | |
| $Host.PopRunspace() | |
| $Child = Get-CimInstance -ClassName win32_process | where {$_.ParentProcessId -eq $Pid} | |
| $Child | ForEach-Object { Stop-Process -Id $_.ProcessId } | |
| }, "ALT+F6") | Out-Null | |
| #Url: https://blog.ironmansoftware.com/using-powershell-7-in-the-windows-powershell-ise | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment