Setting Up PowerShell ISE In VS Code

Introduction

As per a recent note from the MSFT documentation, there are no active improvements in PowerShell ISE, and if you are starting to work on the latest PowerShell 7, there is no ISE support. However, there is an alternative to using VS code with a PowerShell extension. In this article, we will go through step by step in setting up the PowerShell ISE option in VS code. Thanks to Thomas Maurer for pointing in right direction for setting up ISE mode for PowerShell in VS code. 

Pre-requisites

As a pre-requisite, you need to have the VS code installed on your machine. To install VS code, follow the below links from the references section.

The following steps are targeting the Windows 10 operating system. However, similar steps can be followed for MAC and Windows 11.

Step 1. Open the command prompt and navigate to a folder where the PowerShell files need to be saved. In this case, I have created a folder called PSDemo in my local drive.

 command prompt

Step 2. As you can see, this is an empty folder. Open the command prompt and navigate to the folder. And then enter the code.

command prompt and navigate

Step 3. Go to extensions in the VS code program.

VS code program.

Step 4. Search for PowerShell, look for the Microsoft Version, and click on the ‘ Install’ button.

 PowerShell

 PowerShell for vs code

Step 5. validate the installation. After some time, you should see in the same extension window that ‘ This extension is enabled globally.’

enabled globally.

Step 6. Now it's time to enable ISE mode, which is my favorite one. For this, open the command palette(ctrl+shift+P). Type in enable ISE mode in the command option.

 PowerShell ISE mode

Step 7. You should see the terminal set up just like in Windows PowerShell ISE.

 Windows PowerShell

You should also see the PowerShell modules loaded in VS code.

 loaded in VS code.

Step 8. Go to file, and select New text file.

select New text file.

Step 9. You can see a file with the name Untitled-1 is opened.

Untitled-1 is opened.

Validate the setup by running the command to get the PS version. You could see that intellisense is getting popped up.

 PS version

 PS version & PS edition

Step 10. In the top right version, you can also see options to run the script or run the selection.

script or run

You can also run other commands, write your scripts, and execute them. As another test, I tried running the get-module command to know the version of PnP.PowerShell.

Step 11. Now you can work exactly like you are working in PowerShell, and moreover, you get support for PowerShell 7 and later versions in ISE.

versions in ISE.

 PowerShell 7

Conclusion

Thus, in this article, we have seen how to set up PowerShell ISE in VS code.

References


Similar Articles