{"id":5423,"date":"2026-08-27T15:34:53","date_gmt":"2026-08-27T15:34:53","guid":{"rendered":"https:\/\/geekmungus.co.uk\/?p=5423"},"modified":"2026-08-27T15:34:53","modified_gmt":"2026-08-27T15:34:53","slug":"how-to-use-powershell-7-in-powershell-ise","status":"publish","type":"post","link":"https:\/\/geekmungus.co.uk\/?p=5423","title":{"rendered":"How to Use PowerShell 7 in PowerShell ISE"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Although the PowerShell ISE is now no longer supported (apparently), you can allow it to use PowerShell 7, which can be handy if you need to use some of the new PowerShell 7 commands, not available in PowerShell 5 or 6 for example. Or just use VS Code!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Firstly ensure you have PowerShell 7 installed on the machine.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Within your profile&#8217;s <strong>Documents <\/strong>folder create a <strong>WindowsPowerShell<\/strong> folder.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So you have: <strong>c:\\user\\bob\\Documents\\WindowsPowerShell<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now drop in a file called: <strong>Microsoft.PowerShellISE_profile.ps1<\/strong> and add the following to it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Initialize ISE object\n$myISE = $psISE\n\n# Clear any existing AddOns menu items\n$myISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Clear()\n\n# Add a menu option to switch to PowerShell 7 (pwsh.exe)\n$myISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add(\"Switch to PowerShell 7\", { \n    function New-OutOfProcRunspace {\n        param($ProcessId)\n\n        $ci = New-Object -TypeName System.Management.Automation.Runspaces.NamedPipeConnectionInfo -ArgumentList @($ProcessId)\n        $tt = &#91;System.Management.Automation.Runspaces.TypeTable]::LoadDefaultTypeFiles()\n\n        $Runspace = &#91;System.Management.Automation.Runspaces.RunspaceFactory]::CreateRunspace($ci, $Host, $tt)\n        $Runspace.Open()\n        $Runspace\n    }\n\n    # Start PowerShell 7 (pwsh) process with output rendering set to PlainText\n    $PowerShell = Start-Process PWSH -ArgumentList @('-NoExit', '-Command', '$PSStyle.OutputRendering = &#91;System.Management.Automation.OutputRendering]::PlainText') -PassThru -WindowStyle Hidden\n    $Runspace = New-OutOfProcRunspace -ProcessId $PowerShell.Id\n    $Host.PushRunspace($Runspace)\n\n}, \"ALT+F5\") | Out-Null  # Add hotkey ALT+F5\n\n# Add a menu option to switch back to Windows PowerShell 5.1\n$myISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add(\"Switch to Windows PowerShell\", { \n    $Host.PopRunspace()\n\n    # Get the child processes of the current PowerShell instance and stop them\n    $Child = Get-CimInstance -ClassName win32_process | where {$_.ParentProcessId -eq $Pid}\n    $Child | ForEach-Object { Stop-Process -Id $_.ProcessId }\n\n}, \"ALT+F6\") | Out-Null  # Add hotkey ALT+F6\n\n# Custom timestamp function to display before the prompt\nfunction Write-Timestamp {\n    Write-Host (Get-Date).ToString(\"yyyy-MM-dd HH:mm:ss\") -NoNewline -ForegroundColor Yellow\n    Write-Host \"  $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) $($args&#91;0])\"\n}\n\n# Customize the prompt to display a timestamp of the last command\nfunction Prompt {\n    Write-Timestamp \"$(Get-History -Count 1 | Select-Object -ExpandProperty CommandLine)\"\n    return \"PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) \"\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now close and open the PowerShell ISE, you can then see a new menu at top under &#8220;Add-Ons&#8221; to switch to PowerShell 7.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"475\" height=\"120\" src=\"https:\/\/geekmungus.co.uk\/wp-content\/uploads\/2026\/08\/image-7.png\" alt=\"\" class=\"wp-image-5424\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Although the PowerShell ISE is now no longer supported (apparently), you can allow it to use PowerShell 7, which can be handy if you need to use some of the new PowerShell 7 commands, not available in PowerShell 5 or 6 for example. Or just use VS Code! Firstly ensure you have PowerShell 7 installed &#8230; <a title=\"How to Use PowerShell 7 in PowerShell ISE\" class=\"read-more\" href=\"https:\/\/geekmungus.co.uk\/?p=5423\" aria-label=\"Read more about How to Use PowerShell 7 in PowerShell ISE\">Read more<\/a><\/p>\n","protected":false},"author":4,"featured_media":4282,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5423","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/5423","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5423"}],"version-history":[{"count":1,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/5423\/revisions"}],"predecessor-version":[{"id":5425,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/5423\/revisions\/5425"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/media\/4282"}],"wp:attachment":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5423"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}